Project

General

Profile

Paste
Download (1.3 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / themes / bootstrap / templates / system / exposed-filters.func.php @ 1f623f01

1
<?php
2
/**
3
 * @file
4
 * Stub file for bootstrap_exposed_filters().
5
 */
6

    
7
/**
8
 * Returns HTML for an exposed filter form.
9
 *
10
 * @param array $variables
11
 *   An associative array containing:
12
 *   - form: An associative array containing the structure of the form.
13
 *
14
 * @return string
15
 *   The constructed HTML.
16
 *
17
 * @see theme_exposed_filters()
18
 *
19
 * @ingroup theme_functions
20
 */
21
function bootstrap_exposed_filters($variables) {
22
  $form = $variables['form'];
23
  $output = '';
24

    
25
  foreach (element_children($form['status']['filters']) as $key) {
26
    $form['status']['filters'][$key]['#field_prefix'] = '<div class="col-sm-10">';
27
    $form['status']['filters'][$key]['#field_suffix'] = '</div>';
28
  }
29
  $form['status']['actions']['#attributes']['class'][] = 'col-sm-offset-2';
30
  $form['status']['actions']['#attributes']['class'][] = 'col-sm-10';
31

    
32
  if (isset($form['current'])) {
33
    $items = array();
34
    foreach (element_children($form['current']) as $key) {
35
      $items[] = drupal_render($form['current'][$key]);
36
    }
37
    $output .= theme('item_list', array(
38
      'items' => $items,
39
      'attributes' => array(
40
        'class' => array(
41
          'clearfix',
42
          'current-filters',
43
        ),
44
      ),
45
    ));
46
  }
47
  $output .= drupal_render_children($form);
48
  return '<div class="form-horizontal">' . $output . '</div>';
49
}