class ThemeLocalTask
Same name in this branch
- 8.9.x core/modules/block/src/Plugin/Derivative/ThemeLocalTask.php \Drupal\block\Plugin\Derivative\ThemeLocalTask
Same name in other branches
- 9 core/modules/system/src/Plugin/Derivative/ThemeLocalTask.php \Drupal\system\Plugin\Derivative\ThemeLocalTask
- 9 core/modules/block/src/Plugin/Derivative/ThemeLocalTask.php \Drupal\block\Plugin\Derivative\ThemeLocalTask
- 10 core/modules/system/src/Plugin/Derivative/ThemeLocalTask.php \Drupal\system\Plugin\Derivative\ThemeLocalTask
- 10 core/modules/block/src/Plugin/Derivative/ThemeLocalTask.php \Drupal\block\Plugin\Derivative\ThemeLocalTask
- 11.x core/modules/system/src/Plugin/Derivative/ThemeLocalTask.php \Drupal\system\Plugin\Derivative\ThemeLocalTask
- 11.x core/modules/block/src/Plugin/Derivative/ThemeLocalTask.php \Drupal\block\Plugin\Derivative\ThemeLocalTask
Provides dynamic tabs based on active themes.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Component\Plugin\Derivative\DeriverInterface
- class \Drupal\system\Plugin\Derivative\ThemeLocalTask extends \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface
Expanded class hierarchy of ThemeLocalTask
1 string reference to 'ThemeLocalTask'
- system.links.task.yml in core/
modules/ system/ system.links.task.yml - core/modules/system/system.links.task.yml
File
-
core/
modules/ system/ src/ Plugin/ Derivative/ ThemeLocalTask.php, line 13
Namespace
Drupal\system\Plugin\DerivativeView source
class ThemeLocalTask extends DeriverBase implements ContainerDeriverInterface {
/**
* The theme handler.
*
* @var \Drupal\Core\Extension\ThemeHandlerInterface
*/
protected $themeHandler;
/**
* Constructs a new ThemeLocalTask instance.
*
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler.
*/
public function __construct(ThemeHandlerInterface $theme_handler) {
$this->themeHandler = $theme_handler;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container->get('theme_handler'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->themeHandler
->listInfo() as $theme_name => $theme) {
if ($this->themeHandler
->hasUi($theme_name)) {
$this->derivatives[$theme_name] = $base_plugin_definition;
$this->derivatives[$theme_name]['title'] = $theme->info['name'];
$this->derivatives[$theme_name]['route_parameters'] = [
'theme' => $theme_name,
];
}
}
return $this->derivatives;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
DeriverBase::$derivatives | protected | property | List of derivative definitions. | 1 | |
DeriverBase::getDerivativeDefinition | public | function | Gets the definition of a derivative plugin. | Overrides DeriverInterface::getDerivativeDefinition | |
ThemeLocalTask::$themeHandler | protected | property | The theme handler. | ||
ThemeLocalTask::create | public static | function | Creates a new class instance. | Overrides ContainerDeriverInterface::create | |
ThemeLocalTask::getDerivativeDefinitions | public | function | Gets the definition of all derivatives of a base plugin. | Overrides DeriverBase::getDerivativeDefinitions | |
ThemeLocalTask::__construct | public | function | Constructs a new ThemeLocalTask instance. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.