function EntityReference::getReferencedEntityType

Gets the target entity type referenced by this field.

Return value

\Drupal\Core\Entity\EntityTypeInterface The entity type definition.

3 calls to EntityReference::getReferencedEntityType()
EntityReference::getSubHandlerOptions in core/modules/views/src/Plugin/views/filter/EntityReference.php
Get all selection plugins for this entity type.
EntityReference::valueFormAddAutocomplete in core/modules/views/src/Plugin/views/filter/EntityReference.php
Adds an autocomplete element to the form.
EntityReference::valueFormAddSelect in core/modules/views/src/Plugin/views/filter/EntityReference.php
Adds a select element to the form.

File

core/modules/views/src/Plugin/views/filter/EntityReference.php, line 681

Class

EntityReference
Filters a view by entity references.

Namespace

Drupal\views\Plugin\views\filter

Code

protected function getReferencedEntityType() : EntityTypeInterface {
    $field_def = $this->getFieldDefinition();
    $entity_type_id = $field_def->getItemDefinition()
        ->getSetting('target_type');
    return $this->entityTypeManager
        ->getDefinition($entity_type_id);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.