function ConfigNamesMapper::__construct

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

Constructs a ConfigNamesMapper.

Parameters

$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 $config_factory: The configuration factory.

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

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

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

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

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

\Drupal\Core\Language\LanguageManagerInterface $language_manager: 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.

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 135

Class

ConfigNamesMapper
Configuration mapper base implementation.

Namespace

Drupal\config_translation

Code

public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $string_translation, LanguageManagerInterface $language_manager, ?EventDispatcherInterface $event_dispatcher = NULL) {
    $this->pluginId = $plugin_id;
    $this->pluginDefinition = $plugin_definition;
    $this->routeProvider = $route_provider;
    $this->configFactory = $config_factory;
    $this->typedConfigManager = $typed_config;
    $this->localeConfigManager = $locale_config_manager;
    $this->configMapperManager = $config_mapper_manager;
    $this->stringTranslation = $string_translation;
    $this->languageManager = $language_manager;
    $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.