statusmessage.module 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. // $theme['status-form'] = [
  37. // 'variables' => array(
  38. // 'messages' => NULL,
  39. // 'zilla' => 2,
  40. // )
  41. // ];
  42. // $theme['status-form-element'] = [
  43. // 'render element' => 'element'
  44. // ];
  45. // 'template' => 'status-form',
  46. return $theme;
  47. }
  48. /**
  49. * Implements hook_form_alter().
  50. */
  51. //function statusmessage_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  52. // if ($form_id == 'status_form') {
  53. // $form['#theme'] = ['status-form'];
  54. // }
  55. //
  56. //}
  57. /**
  58. * Implements hook_theme_suggestions_HOOK().
  59. */
  60. function statusmessage_theme_suggestions_status(array $variables) {
  61. $suggestions = array();
  62. $entity = $variables['elements']['#status'];
  63. $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
  64. $suggestions[] = 'status__' . $sanitized_view_mode;
  65. $suggestions[] = 'status__' . $entity->bundle();
  66. $suggestions[] = 'status__' . $entity->bundle() . '__' . $sanitized_view_mode;
  67. $suggestions[] = 'status__' . $entity->id();
  68. $suggestions[] = 'status__' . $entity->id() . '__' . $sanitized_view_mode;
  69. return $suggestions;
  70. }