function bootstrap_exposed_filters

7.x-3.x exposed-filters.func.php bootstrap_exposed_filters(array $variables)

Returns HTML for an exposed filter form.

Parameters

array $variables: An associative array containing:

  • form: An associative array containing the structure of the form.

Return value

string The constructed HTML.

Related topics

Source templates/system/exposed-filters.func.php (line 22)

function bootstrap_exposed_filters(array $variables) {
  $form = $variables['form'];
  $output = '';

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

  if (isset($form['current'])) {
    $items = array();
    foreach (element_children($form['current']) as $key) {
      $items[] = drupal_render($form['current'][$key]);
    }
    $build = array(
      '#theme' => 'item_list',
      '#items' => $items,
      '#attributes' => array('class' => array('clearfix', 'current-filters')),
    );
    $output .= drupal_render($build);
  }
  $output .= drupal_render_children($form);
  return '<div class="form-horizontal">' . $output . '</div>';
}