You are here

protected function ThemeSuggestions::buildSuggestions in Express 8

Builds a list of suggestions.

Parameters

string $hook: The theme hook suggestion to build.

Return value

array

1 call to ThemeSuggestions::buildSuggestions()
ThemeSuggestions::addSuggestion in themes/contrib/bootstrap/src/Plugin/Alter/ThemeSuggestions.php
Adds suggestions based on an array of hooks.

File

themes/contrib/bootstrap/src/Plugin/Alter/ThemeSuggestions.php, line 220
Contains \Drupal\bootstrap\Plugin\Alter\ThemeSuggestions.

Class

ThemeSuggestions
Implements hook_theme_suggestions_alter().

Namespace

Drupal\bootstrap\Plugin\Alter

Code

protected function buildSuggestions($hook) {
  $suggestions = [];
  $hook_suggestions = $this->hookSuggestions;

  // Replace the first hook suggestion with $hook.
  array_shift($hook_suggestions);
  array_unshift($suggestions, $hook);
  $suggestions = [];
  while ($hook_suggestions) {
    $suggestions[] = $hook . '__' . implode('__', $hook_suggestions);
    array_pop($hook_suggestions);
  }

  // Append the base hook.
  $suggestions[] = $hook;

  // Return the suggestions, reversed.
  return array_reverse($suggestions);
}