You are here

function opigno_module_theme_suggestions_opigno_answer in Opigno module 8

Same name and namespace in other branches
  1. 3.x opigno_module.module \opigno_module_theme_suggestions_opigno_answer()

Implements hook_theme_suggestions_HOOK().

File

./opigno_module.module, line 185
Contains opigno_module.module.

Code

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