You are here

public function FieldPluginBase::getEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::getEntity()

Gets the entity matching the current row and relationship.

Parameters

\Drupal\views\ResultRow $values: An object containing all retrieved values.

Return value

\Drupal\Core\Entity\EntityInterface Returns the entity matching the values.

Overrides FieldHandlerInterface::getEntity

11 calls to FieldPluginBase::getEntity()
BulkForm::viewsForm in core/modules/system/src/Plugin/views/field/BulkForm.php
Form constructor for the bulk form.
ContactLink::renderLink in core/modules/contact/src/Plugin/views/field/ContactLink.php
Prepares the link to view a entity.
EntityLink::render in core/modules/comment/src/Plugin/views/field/EntityLink.php
Renders the field.
EntityLink::render in core/modules/views/src/Plugin/views/field/EntityLink.php
Renders the field.
EntityOperations::render in core/modules/views/src/Plugin/views/field/EntityOperations.php
Renders the field.

... See full list

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 392
Contains \Drupal\views\Plugin\views\field\FieldPluginBase.

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];
  }
}