function EntityField::__construct

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::__construct()
  2. 8.9.x core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::__construct()
  3. 10 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.

\Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info: The entity type bundle info service.

Overrides HandlerBase::__construct

File

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

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, EntityTypeBundleInfoInterface $entity_type_bundle_info) {
    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;
    $this->entityTypeBundleInfo = $entity_type_bundle_info;
    // @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'];
    }
}

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