function EntityFieldRenderer::__construct

Same name in other branches
  1. 9 core/modules/views/src/Entity/Render/EntityFieldRenderer.php \Drupal\views\Entity\Render\EntityFieldRenderer::__construct()
  2. 10 core/modules/views/src/Entity/Render/EntityFieldRenderer.php \Drupal\views\Entity\Render\EntityFieldRenderer::__construct()
  3. 11.x core/modules/views/src/Entity/Render/EntityFieldRenderer.php \Drupal\views\Entity\Render\EntityFieldRenderer::__construct()

Constructs an EntityFieldRenderer object.

Parameters

\Drupal\views\ViewExecutable $view: The view whose fields are being rendered.

string $relationship: The relationship to be handled.

\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.

Overrides RendererBase::__construct

File

core/modules/views/src/Entity/Render/EntityFieldRenderer.php, line 78

Class

EntityFieldRenderer
Renders entity fields.

Namespace

Drupal\views\Entity\Render

Code

public function __construct(ViewExecutable $view, $relationship, LanguageManagerInterface $language_manager, EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, EntityRepositoryInterface $entity_repository = NULL) {
    parent::__construct($view, $language_manager, $entity_type);
    $this->relationship = $relationship;
    $this->entityTypeManager = $entity_type_manager;
    if (!$entity_repository) {
        @trigger_error('Calling EntityFieldRenderer::__construct() with the $entity_repository argument is supported in drupal:8.7.0 and will be required before drupal:9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
        $entity_repository = \Drupal::service('entity.repository');
    }
    $this->entityRepository = $entity_repository;
}

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