You are here

function mmenu_theme_suggestions_block_alter in Mobile sliding menu 8

Implements hook_theme_suggestions_HOOK_alter().

File

./mmenu.module, line 674
Primarily Drupal hooks and global API functions to manipulate mmenus.

Code

function mmenu_theme_suggestions_block_alter(array &$suggestions, array $variables) {
  if (in_array('mmenu_block', $variables['elements']['#cache']['tags'])) {

    // Adds more template suggestions such as
    // block--mmenu-search--mmenu.html.twig or
    // block--mmenu-search--mmenu-mmenu-right.html.twig.
    $suggestions[] = 'block__' . $variables['elements']['#plugin_id'] . '__' . 'mmenu';
    foreach ($variables['elements']['#cache']['tags'] as $tag) {
      if (strpos($tag, 'mmenu_block:') === 0) {
        list(, $mmenu_name) = explode(':', $tag);
        $suggestions[] = 'block__' . $variables['elements']['#plugin_id'] . '__' . 'mmenu_' . $mmenu_name;
      }
    }
  }
}