You are here

public function EntityField::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::__construct()

Constructs a \Drupal\field\Plugin\views\field\Field object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

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

\Drupal\Core\Field\FormatterPluginManager $formatter_plugin_manager: The field formatter plugin manager.

\Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_plugin_manager: The field plugin type manager.

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

\Drupal\Core\Render\RendererInterface $renderer: The renderer.

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

\Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager: The entity field manager.

Overrides HandlerBase::__construct

File

core/modules/views/src/Plugin/views/field/EntityField.php, line 153

Class

EntityField
A field that displays entity field data.

Namespace

Drupal\views\Plugin\views\field

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, FormatterPluginManager $formatter_plugin_manager, FieldTypePluginManagerInterface $field_type_plugin_manager, LanguageManagerInterface $language_manager, RendererInterface $renderer, EntityRepositoryInterface $entity_repository, EntityFieldManagerInterface $entity_field_manager) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->entityTypeManager = $entity_type_manager;
  $this->formatterPluginManager = $formatter_plugin_manager;
  $this->fieldTypePluginManager = $field_type_plugin_manager;
  $this->languageManager = $language_manager;
  $this->renderer = $renderer;
  $this->entityRepository = $entity_repository;
  $this->entityFieldManager = $entity_field_manager;

  // @todo Unify 'entity field'/'field_name' instead of converting back and
  //   forth. https://www.drupal.org/node/2410779
  if (isset($this->definition['entity field'])) {
    $this->definition['field_name'] = $this->definition['entity field'];
  }
}