You are here

public function OverridesSectionStorage::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::__construct()

Overrides \Drupal\Component\Plugin\PluginBase::__construct().

Overrides the construction of context aware plugins to allow for unvalidated constructor based injection of contexts.

Parameters

array $configuration: The plugin configuration, i.e. an array with configuration values keyed by configuration option name. The special key 'context' may be used to initialize the defined contexts by setting it to an array of context values keyed by context names.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Overrides ContextAwarePluginBase::__construct

File

core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php, line 96

Class

OverridesSectionStorage
Defines the 'overrides' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, SectionStorageManagerInterface $section_storage_manager, EntityRepositoryInterface $entity_repository, AccountInterface $current_user = NULL) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->entityTypeManager = $entity_type_manager;
  $this->entityFieldManager = $entity_field_manager;
  $this->sectionStorageManager = $section_storage_manager;
  $this->entityRepository = $entity_repository;
  if (!$current_user) {
    @trigger_error('The current_user service must be passed to OverridesSectionStorage::__construct(), it is required before Drupal 9.0.0.', E_USER_DEPRECATED);
    $current_user = \Drupal::currentUser();
  }
  $this->currentUser = $current_user;
}