statusmessage.module 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @file
  4. * Contains statusmessage.module..
  5. */
  6. use Drupal\Core\Routing\RouteMatchInterface;
  7. /**
  8. * Implements hook_help().
  9. */
  10. function statusmessage_help($route_name, RouteMatchInterface $route_match) {
  11. switch ($route_name) {
  12. // Main module help for the statusmessage module.
  13. case 'help.page.statusmessage':
  14. $output = '';
  15. $output .= '<h3>' . t('About') . '</h3>';
  16. $output .= '<p>' . t('Status Messages for Users') . '</p>';
  17. return $output;
  18. default:
  19. }
  20. }
  21. /**
  22. * Implements hook_theme().
  23. */
  24. function statusmessage_theme() {
  25. $theme = [];
  26. $theme['status'] = [
  27. 'render element' => 'elements',
  28. 'file' => 'status.page.inc',
  29. 'template' => 'status',
  30. ];
  31. $theme['status_content_add_list'] = [
  32. 'render element' => 'content',
  33. 'variables' => ['content' => NULL],
  34. 'file' => 'status.page.inc',
  35. ];
  36. return $theme;
  37. }
  38. /**
  39. * Implements hook_theme_suggestions_HOOK().
  40. */
  41. function statusmessage_theme_suggestions_status(array $variables) {
  42. $suggestions = array();
  43. $entity = $variables['elements']['#status'];
  44. $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
  45. $suggestions[] = 'status__' . $sanitized_view_mode;
  46. $suggestions[] = 'status__' . $entity->bundle();
  47. $suggestions[] = 'status__' . $entity->bundle() . '__' . $sanitized_view_mode;
  48. $suggestions[] = 'status__' . $entity->id();
  49. $suggestions[] = 'status__' . $entity->id() . '__' . $sanitized_view_mode;
  50. return $suggestions;
  51. }