You are here

function theme_secondary_exposed_elements in Better Exposed Filters 7.3

Same name and namespace in other branches
  1. 8.3 better_exposed_filters.theme \theme_secondary_exposed_elements()

Themes some exposed form elements in a collapsible fieldset.

Parameters

array $vars: An array of arrays, the 'element' item holds the properties of the element.

Return value

string HTML to render the form element.

1 string reference to 'theme_secondary_exposed_elements'
better_exposed_filters_theme in ./better_exposed_filters.module
Implements hook_theme().
1 theme call to theme_secondary_exposed_elements()
better_exposed_filters_exposed_form_plugin::exposed_form_alter in ./better_exposed_filters_exposed_form_plugin.inc
Tweak the exposed filter form to show Better Exposed Filter options.

File

./better_exposed_filters.theme, line 621
Provides theming functions to display exposed forms using different interfaces.

Code

function theme_secondary_exposed_elements($vars) {
  $element = $vars['element'];

  // Render child elements in the order they would appear as exposed filters.
  // First collect the elements that have a specified position and order them
  // based on that position. Then render those without a position.
  $children = array();
  $unordered = array();
  foreach (element_children($element) as $id) {
    if (isset($element[$id]['#bef_position'])) {
      $children[$element[$id]['#bef_position']] = $element[$id];
    }
    else {
      $unordered[] = $element[$id];
    }
  }
  ksort($children, SORT_NUMERIC);
  $children = array_merge($children, $unordered);
  $output = '<div class="bef-secondary-options">';
  foreach ($children as $child) {
    $output .= drupal_render($child);
  }
  $output .= '</div>';
  return $output;
}