function EntityField::__construct

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::__construct()
  2. 10 core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::__construct()
  3. 9 core/modules/views/src/Plugin/views/field/EntityField.php \Drupal\views\Plugin\views\field\EntityField::__construct()
  4. 8.9.x 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 $entityTypeManager: The entity type manager.

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

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

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

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

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

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

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

Overrides HandlerBase::__construct

File

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

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, protected EntityTypeManagerInterface $entityTypeManager, #[Autowire(service: 'plugin.manager.field.formatter')] protected FormatterPluginManager $formatterPluginManager, protected FieldTypePluginManagerInterface $fieldTypePluginManager, protected LanguageManagerInterface $languageManager, RendererInterface $renderer, protected EntityRepositoryInterface $entityRepository, EntityFieldManagerInterface $entity_field_manager, protected EntityTypeBundleInfoInterface $entityTypeBundleInfo) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->renderer = $renderer;
  $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'];
  }
}

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