commit 745832a111d8fc96603d34a31ee20190cdd38a2c Author: Shane Auckland Date: Fri Apr 12 15:43:01 2013 +0100 1898480-new_changes diff --git a/core/includes/form.inc b/core/includes/form.inc index 8bd75da..730398e 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -4762,6 +4762,30 @@ function template_preprocess_form_element_label(&$variables) { } /** + * Preprocess variables for exposed filters templates. + * + * Default template: exposed-filters.html.twig. + * + * @param $variables + * An associative array containing: + * - form: An associative array containing the structure of the form. + */ +function template_preprocess_exposed_filters(&$variables) { + $form = $variables['form']; + + $variables['items'] = ''; + if (isset($form['current'])) { + $items = array(); + foreach (element_children($form['current']) as $key) { + $items[] = drupal_render($form['current'][$key]); + } + $variables['items'] .= theme('item_list', array('items' => $items, 'attributes' => array('class' => array('clearfix', 'current-filters')))); + } + + $variables['form'] = drupal_render_children($form); +} + +/** * Sets a form element's class attribute. * * Adds 'required' and 'error' classes as needed. diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 71c9eca..021b3dc 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -3287,6 +3287,7 @@ function drupal_common_theme() { ), 'exposed_filters' => array( 'render element' => 'form', + 'template' => 'exposed-filters', ), 'checkboxes' => array( 'render element' => 'element', diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 18a5a89..c5fdd54 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -3924,35 +3924,6 @@ function theme_system_settings_form($variables) { } /** - * Returns HTML for an exposed filter form. - * - * @param $variables - * An associative array containing: - * - form: An associative array containing the structure of the form. - * - * @return - * A string containing an HTML-formatted form. - * - * @ingroup themeable - */ -function theme_exposed_filters($variables) { - $form = $variables['form']; - $output = ''; - - if (isset($form['current'])) { - $items = array(); - foreach (element_children($form['current']) as $key) { - $items[] = $form['current'][$key]; - } - $output .= theme('item_list', array('items' => $items, 'attributes' => array('class' => array('clearfix', 'current-filters')))); - } - - $output .= drupal_render_children($form); - - return '
' . $output . '
'; -} - -/** * Implements hook_admin_paths(). */ function system_admin_paths() { diff --git a/core/modules/system/templates/exposed-filters.html.twig b/core/modules/system/templates/exposed-filters.html.twig new file mode 100644 index 0000000..a9904e4 --- /dev/null +++ b/core/modules/system/templates/exposed-filters.html.twig @@ -0,0 +1,20 @@ +{# +/** + * @file + * Default theme implementation of an exposed filter form. + * + * Available variables: + * - form: An associative array containing the structure of the form. + * + * @see template_preprocess() + * @see template_preprocess_exposed_filters() + * + * @ingroup themeable + */ +#} +
+ {% if items %} + {{ items }} + {% endif %} + {{ form }} +