You are here

public function RNGSelectionBase::__construct in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/EntityReferenceSelection/RNGSelectionBase.php \Drupal\rng\Plugin\EntityReferenceSelection\RNGSelectionBase::__construct()
  2. 3.x src/Plugin/EntityReferenceSelection/RNGSelectionBase.php \Drupal\rng\Plugin\EntityReferenceSelection\RNGSelectionBase::__construct()

Constructs a new RegisterIdentityContactSelection object.

Parameters

\Drupal\rng\EventManagerInterface $event_manager: The RNG event manager.

\Drupal\Core\Condition\ConditionManager $condition_manager: The condition plugin manager.

Overrides DefaultSelection::__construct

File

src/Plugin/EntityReferenceSelection/RNGSelectionBase.php, line 37

Class

RNGSelectionBase
Base RNG selection plugin.

Namespace

Drupal\rng\Plugin\EntityReferenceSelection

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, Connection $connection, EventManagerInterface $event_manager, ConditionManager $condition_manager) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_manager, $module_handler, $current_user);
  if (isset($this->configuration['handler_settings']['event_entity_type'], $this->configuration['handler_settings']['event_entity_id'])) {
    $event = $this->entityManager
      ->getStorage($this->configuration['handler_settings']['event_entity_type'])
      ->load($this->configuration['handler_settings']['event_entity_id']);
    $this->eventMeta = $event_manager
      ->getMeta($event);
  }
  else {
    throw new \Exception('RNG selection handler requires event context.');
  }
  $this->conditionManager = $condition_manager;
  $this->entityType = $this->entityManager
    ->getDefinition($this->configuration['target_type']);
}