<?php

/**
 * @file
 * Support module for testing theme suggestions.
 */

/**
 * Implements hook_theme().
 */
function theme_suggestions_test_theme() {
  $items['theme_suggestions_test_include'] = [
    'file' => 'theme_suggestions_test.inc',
    'variables' => [],
    'function' => 'theme_theme_suggestions_test_include',
  ];
  return $items;
}

/**
 * Implements hook_theme_suggestions_alter().
 */
function theme_suggestions_test_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
  drupal_set_message(__FUNCTION__ . '() executed.');
  if ($hook == 'theme_test_general_suggestions') {
    $suggestions[] = $hook . '__module_override';
  }
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function theme_suggestions_test_theme_suggestions_theme_test_suggestions_alter(array &$suggestions, array $variables) {
  drupal_set_message(__FUNCTION__ . '() executed.');
  $suggestions[] = 'theme_test_suggestions__' . 'module_override';
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function theme_suggestions_test_theme_suggestions_theme_test_function_suggestions_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'theme_test_function_suggestions__' . 'module_override';
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function theme_suggestions_test_theme_suggestions_theme_test_specific_suggestions_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'theme_test_specific_suggestions__' . 'variant__foo';
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function theme_suggestions_test_theme_suggestions_theme_test_suggestions_include_alter(array &$suggestions, array $variables, $hook) {
  $suggestions[] = 'theme_suggestions_test_include';
}
