class ConfigTranslationLocalTasks
Same name in other branches
- 9 core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationLocalTasks.php \Drupal\config_translation\Plugin\Derivative\ConfigTranslationLocalTasks
- 8.9.x core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationLocalTasks.php \Drupal\config_translation\Plugin\Derivative\ConfigTranslationLocalTasks
- 10 core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationLocalTasks.php \Drupal\config_translation\Plugin\Derivative\ConfigTranslationLocalTasks
Provides dynamic local tasks for config translation.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Component\Plugin\Derivative\DeriverInterface
- class \Drupal\config_translation\Plugin\Derivative\ConfigTranslationLocalTasks extends \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface
Expanded class hierarchy of ConfigTranslationLocalTasks
1 string reference to 'ConfigTranslationLocalTasks'
- config_translation.links.task.yml in core/
modules/ config_translation/ config_translation.links.task.yml - core/modules/config_translation/config_translation.links.task.yml
File
-
core/
modules/ config_translation/ src/ Plugin/ Derivative/ ConfigTranslationLocalTasks.php, line 13
Namespace
Drupal\config_translation\Plugin\DerivativeView source
class ConfigTranslationLocalTasks extends DeriverBase implements ContainerDeriverInterface {
/**
* The mapper plugin discovery service.
*
* @var \Drupal\config_translation\ConfigMapperManagerInterface
*/
protected $mapperManager;
/**
* The base plugin ID.
*
* @var string
*/
protected $basePluginId;
/**
* Constructs a new ConfigTranslationLocalTasks.
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\config_translation\ConfigMapperManagerInterface $mapper_manager
* The mapper plugin discovery service.
*/
public function __construct($base_plugin_id, ConfigMapperManagerInterface $mapper_manager) {
$this->basePluginId = $base_plugin_id;
$this->mapperManager = $mapper_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($base_plugin_id, $container->get('plugin.manager.config_translation.mapper'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$mappers = $this->mapperManager
->getMappers();
foreach ($mappers as $plugin_id => $mapper) {
/** @var \Drupal\config_translation\ConfigMapperInterface $mapper */
$route_name = $mapper->getOverviewRouteName();
$base_route = $mapper->getBaseRouteName();
if (!empty($base_route)) {
$this->derivatives[$route_name] = $base_plugin_definition;
$this->derivatives[$route_name]['config_translation_plugin_id'] = $plugin_id;
$this->derivatives[$route_name]['class'] = '\\Drupal\\config_translation\\Plugin\\Menu\\LocalTask\\ConfigTranslationLocalTask';
$this->derivatives[$route_name]['route_name'] = $route_name;
$this->derivatives[$route_name]['base_route'] = $base_route;
}
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
ConfigTranslationLocalTasks::$basePluginId | protected | property | The base plugin ID. | ||
ConfigTranslationLocalTasks::$mapperManager | protected | property | The mapper plugin discovery service. | ||
ConfigTranslationLocalTasks::create | public static | function | Creates a new class instance. | Overrides ContainerDeriverInterface::create | |
ConfigTranslationLocalTasks::getDerivativeDefinitions | public | function | Gets the definition of all derivatives of a base plugin. | Overrides DeriverBase::getDerivativeDefinitions | |
ConfigTranslationLocalTasks::__construct | public | function | Constructs a new ConfigTranslationLocalTasks. | ||
DeriverBase::$derivatives | protected | property | List of derivative definitions. | 1 | |
DeriverBase::getDerivativeDefinition | public | function | Gets the definition of a derivative plugin. | Overrides DeriverInterface::getDerivativeDefinition |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.