function hook_system_themes_page_alter in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/system.api.php \hook_system_themes_page_alter()
- 7 modules/system/system.api.php \hook_system_themes_page_alter()
Alters theme operation links.
Parameters
$theme_groups: An associative array containing groups of themes.
See also
system_themes_page()
Related topics
1 invocation of hook_system_themes_page_alter()
- SystemController::themesPage in core/
modules/ system/ src/ Controller/ SystemController.php - Returns a theme listing.
File
- core/
modules/ system/ system.api.php, line 23 - Hooks provided by the System module.
Code
function hook_system_themes_page_alter(&$theme_groups) {
foreach ($theme_groups as $state => &$group) {
foreach ($theme_groups[$state] as &$theme) {
// Add a foo link to each list of theme operations.
$theme->operations[] = [
'title' => t('Foo'),
'url' => Url::fromRoute('system.themes_page'),
'query' => [
'theme' => $theme
->getName(),
],
];
}
}
}