You are here

class FarmLogViewsData in farmOS 2.x

Provides the views data for the log entity type.

Hierarchy

Expanded class hierarchy of FarmLogViewsData

1 file declares its use of FarmLogViewsData
farm_entity_views.module in modules/core/entity/modules/views/farm_entity_views.module
Contains farm_entity_views.module.

File

modules/core/entity/modules/views/src/FarmLogViewsData.php, line 11

Namespace

Drupal\farm_entity_views
View source
class FarmLogViewsData extends LogViewsData {
  use EntityViewsDataTaxonomyFilterTrait;

  /**
   * {@inheritdoc}
   */
  public function getViewsData() {
    $data = parent::getViewsData();

    // Provide a reverse entity reference relationship from quantities to logs
    // that reference them.
    // Workaround for core issue #2706431.
    // Copied from Entity API module's EntityViewsData, modified to support
    // Entity Reference Revisions field.
    // @todo Patch Entity to support Entity Reference Revisions instead?
    $entity_type_id = $this->entityType
      ->id();
    $base_fields = $this
      ->getEntityFieldManager()
      ->getBaseFieldDefinitions($entity_type_id);
    $entity_reference_fields = array_filter($base_fields, function (BaseFieldDefinition $field) {
      return !$field
        ->isComputed() && $field
        ->getType() == 'entity_reference_revisions';
    });
    $this
      ->addReverseRelationships($data, $entity_reference_fields);
    return $data;
  }

}

Members