function FieldPluginBase::getEntity

Same name and namespace in other branches
  1. 11.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 calls to FieldPluginBase::getEntity()
EntityLink::getUrlInfo in core/modules/views/src/Plugin/views/field/EntityLink.php
Returns the URI elements of the link.
EntityLink::render in core/modules/views/src/Plugin/views/field/EntityLink.php
Renders the field.
MediaLibrarySelectForm::viewsForm in core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php
Form constructor for the media library select form.

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.