You are here

function media_entity_theme_suggestions_media in Media entity 8

Implements hook_theme_suggestions_HOOK().

File

./media_entity.module, line 48
Provides media entities.

Code

function media_entity_theme_suggestions_media(array $variables) {
  $suggestions = [];
  $media = $variables['elements']['#media'];
  $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
  $suggestions[] = 'media__' . $sanitized_view_mode;
  $suggestions[] = 'media__' . $media
    ->bundle();
  $suggestions[] = 'media__' . $media
    ->bundle() . '__' . $sanitized_view_mode;
  $suggestions[] = 'media__' . $media
    ->id();
  $suggestions[] = 'media__' . $media
    ->id() . '__' . $sanitized_view_mode;
  return $suggestions;
}