function SearchThemeHooks::preprocessBlock

Implements hook_preprocess_HOOK() for block templates.

Attributes

#[Hook('preprocess_block')]

File

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

Class

SearchThemeHooks
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.