public function StyleguideMenuLinks::getDerivativeDefinitions in Style Guide 8
Same name and namespace in other branches
- 2.x src/Plugin/Derivative/StyleguideMenuLinks.php \Drupal\styleguide\Plugin\Derivative\StyleguideMenuLinks::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/ StyleguideMenuLinks.php, line 44
Class
- StyleguideMenuLinks
- Styleguide menu links.
Namespace
Drupal\styleguide\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$themes = $this->themeHandler
->rebuildThemeData();
foreach ($themes as $theme) {
if (!empty($theme->info['hidden'])) {
continue;
}
if ($theme->status) {
$route_name = 'styleguide.' . $theme
->getName();
$this->derivatives[$route_name] = $base_plugin_definition + [
'title' => $theme->info['name'],
'route_name' => $route_name,
];
}
}
return $this->derivatives;
}