function theme_select_as_checkboxes_fieldset in Better Exposed Filters 7.3
Same name and namespace in other branches
- 6.3 better_exposed_filters.theme \theme_select_as_checkboxes_fieldset()
- 6 better_exposed_filters.theme \theme_select_as_checkboxes_fieldset()
- 6.2 better_exposed_filters.theme \theme_select_as_checkboxes_fieldset()
- 7 better_exposed_filters.theme \theme_select_as_checkboxes_fieldset()
Themes a select element as checkboxes enclosed in a collapsible fieldset.
Parameters
array $vars: An array of arrays, the 'element' item holds the properties of the element
Return value
string HTML representing the form element.
1 string reference to 'theme_select_as_checkboxes_fieldset'
- better_exposed_filters_theme in ./
better_exposed_filters.module - Implements hook_theme().
File
- ./
better_exposed_filters.theme, line 17 - Provides theming functions to display exposed forms using different interfaces.
Code
function theme_select_as_checkboxes_fieldset($vars) {
// Merge incoming element with some default values. Prevents a lot of this.
// $foo = isset($bar) ? $bar : $bar_default;
$element = array_merge(array(
'#bef_title' => '',
'#bef_description' => '',
'#bef_operator' => array(),
), $vars['element']);
$fieldset = array(
'#title' => $element['#bef_title'],
'#description' => $element['#bef_description'],
'#attributes' => array(
'class' => array(
'bef-select-as-checkboxes-fieldset',
'collapsible',
),
),
);
if (empty($element['#value'])) {
// Using the FAPI #collapsible and #collapsed attribute doesn't work here
// TODO: not sure why...
$fieldset['#attributes']['class'][] = 'collapsed';
}
// We rendered the description as part of the fieldset element, don't render
// it again along with the checkboxes.
unset($element['#bef_description']);
$children = '';
if (!empty($element['#bef_operator'])) {
// Put an exposed operator inside the fieldset.
$children = drupal_render($element['#bef_operator']);
}
// Render the checkboxes.
$children .= theme('select_as_checkboxes', array(
'element' => $element,
));
$fieldset['#children'] = $children;
return theme('fieldset', array(
'element' => $fieldset,
));
}