You are here

function opigno_certificate_theme_suggestions_opigno_certificate in Opigno certificate 8

Same name and namespace in other branches
  1. 3.x opigno_certificate.module \opigno_certificate_theme_suggestions_opigno_certificate()

Implements hook_theme_suggestions_HOOK().

File

./opigno_certificate.module, line 194
Contains opigno_certificate.module.

Code

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

  /** @var \Drupal\opigno_certificate\CertificateInterface $opigno_certificate */
  $opigno_certificate = $variables['elements']['#opigno_certificate'];
  $view_mode = $variables['elements']['#view_mode'];
  if ($view_mode == 'default') {
    $view_mode = 'full';
  }
  $sanitized_view_mode = strtr($view_mode, '.', '_');
  $suggestions[] = 'opigno_certificate__' . $sanitized_view_mode;
  $suggestions[] = 'opigno_certificate__' . $opigno_certificate
    ->bundle();
  $suggestions[] = 'opigno_certificate__' . $opigno_certificate
    ->bundle() . '__' . $sanitized_view_mode;
  $suggestions[] = 'opigno_certificate__' . $opigno_certificate
    ->id();
  $suggestions[] = 'opigno_certificate__' . $opigno_certificate
    ->id() . '__' . $sanitized_view_mode;
  return $suggestions;
}