template_preprocess_views_exposed_form

template_preprocess_views_exposed_form(&$variables)

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/views.theme.inc, line 985
Preprocessors and helper functions to make theming easier.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function template_preprocess_views_exposed_form(&$variables) {
  $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'];
    }
  }
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.