You are here

function ui_patterns_ui_patterns_suggestions_alter in UI Patterns 8

Implements hook_ui_patterns_suggestions_alter().

File

./ui_patterns.module, line 62
Contains ui_patterns.module.

Code

function ui_patterns_ui_patterns_suggestions_alter(array &$suggestions, array $variables, PatternContext $context) {

  // Add preview theme suggestion.
  if ($context
    ->isOfType('preview')) {
    $suggestions[] = $variables['theme_hook_original'] . '__preview';
  }
  if (!empty($variables['variant'])) {
    $suggestions[] = $variables['theme_hook_original'] . '__variant_' . $variables['variant'];

    // Add variant preview theme suggestion.
    if ($context
      ->isOfType('preview')) {
      $suggestions[] = $variables['theme_hook_original'] . '__variant_' . $variables['variant'] . '__preview';
    }
  }
}