protected function EntityField::getEntityFieldRenderer in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::getEntityFieldRenderer()
Returns the entity field renderer.
Return value
\Drupal\views\Entity\Render\EntityFieldRenderer The entity field renderer.
File
- core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php, line 801
Class
- EntityField
- A field that displays entity field data.
Namespace
Drupal\views\Plugin\views\fieldCode
protected function getEntityFieldRenderer() {
if (!isset($this->entityFieldRenderer)) {
// This can be invoked during field handler initialization in which case
// view fields are not set yet.
if (!empty($this->view->field)) {
foreach ($this->view->field as $field) {
// An entity field renderer can handle only a single relationship.
if ($field->relationship == $this->relationship && isset($field->entityFieldRenderer)) {
$this->entityFieldRenderer = $field->entityFieldRenderer;
break;
}
}
}
if (!isset($this->entityFieldRenderer)) {
$entity_type = $this->entityTypeManager
->getDefinition($this
->getEntityType());
$this->entityFieldRenderer = new EntityFieldRenderer($this->view, $this->relationship, $this->languageManager, $entity_type, $this->entityTypeManager, $this->entityRepository);
}
}
return $this->entityFieldRenderer;
}