You are here

function message_theme_suggestions_message in Message 8

Implements hook_theme_suggestions_HOOK().

File

./message.module, line 215
API functions to manipulate messages.

Code

function message_theme_suggestions_message(array $variables) {
  $suggestions = [];

  /** @var \Drupal\message\MessageInterface $message */
  $message = $variables['elements']['#message'];
  $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
  $suggestions[] = 'message__' . $sanitized_view_mode;
  $suggestions[] = 'message__' . $message
    ->bundle();
  $suggestions[] = 'message__' . $message
    ->bundle() . '__' . $sanitized_view_mode;
  $suggestions[] = 'message__' . $message
    ->id();
  $suggestions[] = 'message__' . $message
    ->id() . '__' . $sanitized_view_mode;
  return $suggestions;
}