You are here

public function DefaultSelection::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::__construct()
  2. 10 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::__construct()

Constructs a new DefaultSelection 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 manager service.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler service.

\Drupal\Core\Session\AccountInterface $current_user: The current user.

\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.

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

Overrides SelectionPluginBase::__construct

1 call to DefaultSelection::__construct()
UserSelection::__construct in core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
Constructs a new UserSelection object.
1 method overrides DefaultSelection::__construct()
UserSelection::__construct in core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php
Constructs a new UserSelection object.

File

core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php, line 115

Class

DefaultSelection
Default plugin implementation of the Entity Reference Selection plugin.

Namespace

Drupal\Core\Entity\Plugin\EntityReferenceSelection

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, EntityFieldManagerInterface $entity_field_manager = NULL, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, EntityRepositoryInterface $entity_repository = NULL) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->entityTypeManager = $entity_type_manager;
  $this->moduleHandler = $module_handler;
  $this->currentUser = $current_user;
  if (!$entity_field_manager) {
    @trigger_error('Calling DefaultSelection::__construct() with the $entity_field_manager 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_field_manager = \Drupal::service('entity_field.manager');
  }
  $this->entityFieldManager = $entity_field_manager;
  if (!$entity_type_bundle_info) {
    @trigger_error('Calling DefaultSelection::__construct() with the $entity_type_bundle_info 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_type_bundle_info = \Drupal::service('entity_type.bundle.info');
  }
  $this->entityTypeBundleInfo = $entity_type_bundle_info;
  if (!$entity_repository) {
    @trigger_error('Calling DefaultSelection::__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;
}