function FieldPluginBase::getEntity

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::getEntity()
  2. 10 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::getEntity()
  3. 11.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::getEntity()

Overrides FieldHandlerInterface::getEntity

17 calls to FieldPluginBase::getEntity()
BulkForm::viewsForm in core/modules/views/src/Plugin/views/field/BulkForm.php
Form constructor for the bulk form.
CommentedEntity::getItems in core/modules/comment/src/Plugin/views/field/CommentedEntity.php
Gets an array of items for the field.
ContactLink::renderLink in core/modules/contact/src/Plugin/views/field/ContactLink.php
Prepares the link to view an entity.
EntityField::getItems in core/modules/views/src/Plugin/views/field/EntityField.php
Gets an array of items for the field.
EntityField::getValue in core/modules/views/src/Plugin/views/field/EntityField.php
Gets the value that's supposed to be rendered.

... See full list

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 406

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function getEntity(ResultRow $values) {
    $relationship_id = $this->options['relationship'];
    if ($relationship_id == 'none') {
        return $values->_entity;
    }
    elseif (isset($values->_relationship_entities[$relationship_id])) {
        return $values->_relationship_entities[$relationship_id];
    }
}

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