class SearchThemeHooks

Hook implementations for search.

Hierarchy

Expanded class hierarchy of SearchThemeHooks

File

core/modules/search/src/Hook/SearchThemeHooks.php, line 10

Namespace

Drupal\search\Hook
View source
class SearchThemeHooks {
  
  /**
   * Implements hook_theme_suggestions_HOOK().
   */
  public function themeSuggestionsSearchResult(array $variables) : array {
    return [
      'search_result__' . $variables['plugin_id'],
    ];
  }
  
  /**
   * Implements hook_preprocess_HOOK() for block templates.
   */
  public function preprocessBlock(&$variables) : void {
    if ($variables['plugin_id'] == 'search_form_block') {
      $variables['attributes']['role'] = 'search';
    }
  }

}

Members

Title Sort descending Modifiers Object type Summary
SearchThemeHooks::preprocessBlock public function Implements hook_preprocess_HOOK() for block templates.
SearchThemeHooks::themeSuggestionsSearchResult public function Implements hook_theme_suggestions_HOOK().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.