class DynamicLocalTasks in Total Control Admin Dashboard 8.2
Same name and namespace in other branches
- 3.0.x src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\total_control\Plugin\Derivative\DynamicLocalTasks
Defines dynamic local tasks.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\total_control\Plugin\Derivative\DynamicLocalTasks implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of DynamicLocalTasks
1 string reference to 'DynamicLocalTasks'
File
- src/
Plugin/ Derivative/ DynamicLocalTasks.php, line 14
Namespace
Drupal\total_control\Plugin\DerivativeView source
class DynamicLocalTasks extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* Creates a defines dynamic local tasks instance.
*
* @param string $base_plugin_id
* Base plugin id.
* @param Drupal\Core\StringTranslation\TranslationInterface $string_translation
* String translation manager.
*/
public function __construct($base_plugin_id, TranslationInterface $string_translation) {
$this
->setStringTranslation($string_translation);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($base_plugin_id, $container
->get('string_translation'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$moduleHandler = \Drupal::service('module_handler');
$router = \Drupal::service('router.route_provider');
$this->derivatives = [];
if ($moduleHandler
->moduleExists('comment') && !empty($router
->getRoutesByNames([
'view.control_comments.page_1',
]))) {
$this->derivatives['total_control.comments'] = $base_plugin_definition;
$this->derivatives['total_control.comments']['title'] = $this
->t('Comments');
$this->derivatives['total_control.comments']['base_route'] = 'page_manager.page_view_total_control_dashboard_total_control_dashboard-http_status_code-0';
$this->derivatives['total_control.comments']['route_name'] = 'view.control_comments.page_1';
}
if ($moduleHandler
->moduleExists('taxonomy') && !empty($router
->getRoutesByNames([
'view.control_terms.page_1',
]))) {
$this->derivatives['total_control.categories'] = $base_plugin_definition;
$this->derivatives['total_control.categories']['title'] = $this
->t('Categories');
$this->derivatives['total_control.categories']['base_route'] = 'page_manager.page_view_total_control_dashboard_total_control_dashboard-http_status_code-0';
$this->derivatives['total_control.categories']['route_name'] = 'view.control_terms.page_1';
}
if ($moduleHandler
->moduleExists('node') && !empty($router
->getRoutesByNames([
'view.control_content.page_1',
]))) {
$this->derivatives['total_control.categories'] = $base_plugin_definition;
$this->derivatives['total_control.categories']['title'] = $this
->t('Content');
$this->derivatives['total_control.categories']['base_route'] = 'page_manager.page_view_total_control_dashboard_total_control_dashboard-http_status_code-0';
$this->derivatives['total_control.categories']['route_name'] = 'view.control_content.page_1';
}
if ($moduleHandler
->moduleExists('user') && !empty($router
->getRoutesByNames([
'view.control_users.page_1',
]))) {
$this->derivatives['total_control.categories'] = $base_plugin_definition;
$this->derivatives['total_control.categories']['title'] = $this
->t('User Accounts');
$this->derivatives['total_control.categories']['base_route'] = 'page_manager.page_view_total_control_dashboard_total_control_dashboard-http_status_code-0';
$this->derivatives['total_control.categories']['route_name'] = 'view.control_users.page_1';
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
DynamicLocalTasks:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
DynamicLocalTasks:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
DynamicLocalTasks:: |
public | function | Creates a defines dynamic local tasks instance. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |