public function DynamicLocalTasks::getDerivativeDefinitions in Total Control Admin Dashboard 3.0.x
Same name and namespace in other branches
- 8.2 src/Plugin/Derivative/DynamicLocalTasks.php \Drupal\total_control\Plugin\Derivative\DynamicLocalTasks::getDerivativeDefinitions()
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- src/
Plugin/ Derivative/ DynamicLocalTasks.php, line 43
Class
- DynamicLocalTasks
- Defines dynamic local tasks.
Namespace
Drupal\total_control\Plugin\DerivativeCode
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;
}