You are here

protected function ThemeSuggestions::getAlterMethods in Express 8

Retrieves the methods to invoke to process the theme hook suggestion.

Return value

array An indexed array of methods to be invoked.

1 call to ThemeSuggestions::getAlterMethods()
ThemeSuggestions::processSuggestions in themes/contrib/bootstrap/src/Plugin/Alter/ThemeSuggestions.php
Processes the necessary theme hook suggestions.

File

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

Class

ThemeSuggestions
Implements hook_theme_suggestions_alter().

Namespace

Drupal\bootstrap\Plugin\Alter

Code

protected function getAlterMethods() {

  // Retrieve cached theme hook suggestion alter methods.
  $cache = $this->theme
    ->getCache('theme_hook_suggestions');
  if ($cache
    ->has($this->hook)) {
    return $cache
      ->get($this->hook);
  }

  // Uppercase each theme hook suggestion to be used in the method name.
  $hook_suggestions = $this->hookSuggestions;
  foreach ($hook_suggestions as $key => $suggestion) {
    $hook_suggestions[$key] = Unicode::ucfirst($suggestion);
  }
  $methods = [];
  while ($hook_suggestions) {
    $method = 'alter' . implode('', $hook_suggestions);
    if (method_exists($this, $method)) {
      $methods[] = $method;
    }
    array_pop($hook_suggestions);
  }

  // Reverse the methods.
  $methods = array_reverse($methods);

  // Cache the methods.
  $cache
    ->set($this->hook, $methods);
  return $methods;
}