function ClaroHooks::formViewsExposedFormAlter

Implements hook_form_FORM_ID_alter() for views_exposed_form.

Attributes

#[Hook('form_views_exposed_form_alter')]

File

core/themes/claro/src/Hook/ClaroHooks.php, line 679

Class

ClaroHooks
Hook implementations for claro.

Namespace

Drupal\claro\Hook

Code

public function formViewsExposedFormAlter(&$form, FormStateInterface $form_state) : void {
  $view = $form_state->getStorage()['view'];
  $view_title = $view->getTitle();
  // Add a label so screen readers can identify the purpose of the exposed
  // form without having to scan content that appears further down the page.
  $form['#attributes']['aria-label'] = $this->t('Filter the contents of the %view_title view', [
    '%view_title' => $view_title,
  ]);
}

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