function SearchThemeHooks::preprocessBlock

Same name and namespace in other branches
  1. 11.x core/modules/search/src/Hook/SearchThemeHooks.php \Drupal\search\Hook\SearchThemeHooks::preprocessBlock()

Implements hook_preprocess_HOOK() for block templates.

Attributes

#[Hook('preprocess_block')]

File

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

Class

SearchThemeHooks
Theme hook implementations for search.

Namespace

Drupal\search\Hook

Code

public function preprocessBlock(&$variables) : void {
  if ($variables['plugin_id'] == 'search_form_block') {
    $variables['attributes']['role'] = 'search';
  }
}

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