system.api.php 720 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @file
  4. * Hooks provided by the System module.
  5. */
  6. use Drupal\Core\Url;
  7. /**
  8. * @addtogroup hooks
  9. * @{
  10. */
  11. /**
  12. * Alters theme operation links.
  13. *
  14. * @param $theme_groups
  15. * An associative array containing groups of themes.
  16. *
  17. * @see system_themes_page()
  18. */
  19. function hook_system_themes_page_alter(&$theme_groups) {
  20. foreach ($theme_groups as $state => &$group) {
  21. foreach ($theme_groups[$state] as &$theme) {
  22. // Add a foo link to each list of theme operations.
  23. $theme->operations[] = [
  24. 'title' => t('Foo'),
  25. 'url' => Url::fromRoute('system.themes_page'),
  26. 'query' => ['theme' => $theme->getName()],
  27. ];
  28. }
  29. }
  30. }
  31. /**
  32. * @} End of "addtogroup hooks".
  33. */