function theme_select_as_radios in Better Exposed Filters 7
Same name and namespace in other branches
- 6.3 better_exposed_filters.theme \theme_select_as_radios()
- 6 better_exposed_filters.theme \theme_select_as_radios()
- 6.2 better_exposed_filters.theme \theme_select_as_radios()
- 7.3 better_exposed_filters.theme \theme_select_as_radios()
Themes a select drop-down as a collection of radio buttons
Parameters
array $vars - An array of arrays, the 'element' item holds the properties of the element.: Properties used: return_value, value, attributes, title, description
Return value
HTML string representing the form element.
See also
theme_select(), http://api.drupal.org/api/function/theme_select/7
1 string reference to 'theme_select_as_radios'
- better_exposed_filters_theme in ./
better_exposed_filters.module - Implements hook_theme().
1 theme call to theme_select_as_radios()
- theme_select_as_radios_fieldset in ./
better_exposed_filters.theme - Themes a select element as a collection of radio buttons enclosed in a collapsible fieldset
File
- ./
better_exposed_filters.theme, line 230
Code
function theme_select_as_radios($vars) {
$element =& $vars['element'];
if (!empty($element['#bef_nested'])) {
return theme('select_as_tree', $vars);
}
$attributes = array();
if (isset($element['#id'])) {
$attributes['id'] = $element['#id'];
}
$attributes['class'] = array(
'bef-select-as-radios form-radios',
);
if (!empty($element['#attributes']['class'])) {
$attributes['class'] = array_merge($attributes['class'], $element['#attributes']['class']);
}
$output = '';
foreach (element_children($element) as $key) {
$element[$key]['#default_value'] = NULL;
$element[$key]['#children'] = theme('radio', array(
'element' => $element[$key],
));
$output .= theme('form_element', array(
'element' => $element[$key],
));
}
return '<div' . drupal_attributes($attributes) . '>' . $output . '</div>';
}