function ConfigNamesMapper::__construct

Same name and namespace in other branches
  1. 11.x core/modules/config_translation/src/ConfigNamesMapper.php \Drupal\config_translation\ConfigNamesMapper::__construct()
  2. 10 core/modules/config_translation/src/ConfigNamesMapper.php \Drupal\config_translation\ConfigNamesMapper::__construct()
  3. 9 core/modules/config_translation/src/ConfigNamesMapper.php \Drupal\config_translation\ConfigNamesMapper::__construct()
  4. 8.9.x core/modules/config_translation/src/ConfigNamesMapper.php \Drupal\config_translation\ConfigNamesMapper::__construct()

Constructs a ConfigNamesMapper.

Parameters

string $plugin_id: The config mapper plugin ID.

mixed $plugin_definition: An array of plugin information with the following keys:

  • title: The title of the mapper, used for generating page titles.
  • base_route_name: The route name of the base route this mapper is attached to.
  • names: (optional) An array of configuration names.
  • weight: (optional) The weight of this mapper, used in mapper listings. Defaults to 20.
  • list_controller: (optional) Class name for list controller used to generate lists of this type of configuration.

\Drupal\Core\Config\ConfigFactoryInterface $configFactory: The configuration factory.

\Drupal\Core\Config\TypedConfigManagerInterface $typedConfigManager: The typed configuration manager.

\Drupal\locale\LocaleConfigManager $localeConfigManager: The locale configuration manager.

\Drupal\config_translation\ConfigMapperManagerInterface $configMapperManager: The mapper plugin discovery service.

\Drupal\Core\Routing\RouteProviderInterface $routeProvider: The route provider.

\Drupal\Core\StringTranslation\TranslationInterface $string_translation: The string translation manager.

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

\Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher: (optional) The event dispatcher.

Throws

\Symfony\Component\Routing\Exception\RouteNotFoundException Throws an exception if the route specified by the 'base_route_name' in the plugin definition could not be found by the route provider.

Overrides PluginBase::__construct

1 call to ConfigNamesMapper::__construct()
ConfigEntityMapper::__construct in core/modules/config_translation/src/ConfigEntityMapper.php
Constructs a ConfigEntityMapper.
1 method overrides ConfigNamesMapper::__construct()
ConfigEntityMapper::__construct in core/modules/config_translation/src/ConfigEntityMapper.php
Constructs a ConfigEntityMapper.

File

core/modules/config_translation/src/ConfigNamesMapper.php, line 93

Class

ConfigNamesMapper
Configuration mapper base implementation.

Namespace

Drupal\config_translation

Code

public function __construct($plugin_id, $plugin_definition, protected ConfigFactoryInterface $configFactory, protected TypedConfigManagerInterface $typedConfigManager, protected LocaleConfigManager $localeConfigManager, protected ConfigMapperManagerInterface $configMapperManager, protected RouteProviderInterface $routeProvider, TranslationInterface $string_translation, protected LanguageManagerInterface $languageManager, ?EventDispatcherInterface $event_dispatcher = NULL) {
  $this->pluginId = $plugin_id;
  $this->pluginDefinition = $plugin_definition;
  $this->stringTranslation = $string_translation;
  $this->eventDispatcher = $event_dispatcher ?: \Drupal::service('event_dispatcher');
}

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