function ViewsThemeHooks::preprocessViewsExposedForm
Prepares variables for views exposed form templates.
Default template: views-exposed-form.html.twig.
Parameters
array $variables: An associative array containing:
- form: A render element representing the form.
File
-
core/
modules/ views/ src/ Hook/ ViewsThemeHooks.php, line 1245
Class
- ViewsThemeHooks
- Hook implementations for views.
Namespace
Drupal\views\HookCode
public function preprocessViewsExposedForm(array &$variables) : void {
$form =& $variables['form'];
if (!empty($form['q'])) {
$variables['q'] = $form['q'];
}
foreach ($form['#info'] as $info) {
if (!empty($info['label'])) {
$form[$info['value']]['#title'] = $info['label'];
}
if (!empty($info['description'])) {
$form[$info['value']]['#description'] = $info['description'];
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.