function theme_select2_hidden in Select 2 7
Returns HTML for a hidden form element for Select2 plugin.
Parameters
array $variables: An associative array containing:
- element: An associative array containing the properties of the element. Properties used: #name, #value, #attributes.
1 theme call to theme_select2_hidden()
- select2_element_info in ./
select2.module - Implements hook_element_info().
File
- ./
select2.module, line 212 - Main file for Select2 module.
Code
function theme_select2_hidden($variables) {
$element = $variables['element'];
$element['#attributes']['type'] = 'hidden';
element_set_attributes($element, array(
'name',
'value',
));
$element['#attributes'] = isset($element['#attributes']) ? is_array($element['#attributes']) ? $element['#attributes'] : array() : array();
_form_set_class($element);
if (isset($element['#attributes']['value']) && is_array($element['#attributes']['value'])) {
$element['#attributes']['value'] = implode(isset($element['#select2']['separator']) ? $element['#select2']['separator'] : SELECT2_VALUES_SEPARATOR, $element['#attributes']['value']);
}
if (isset($element['#id']) && !isset($element['#attributes']['id'])) {
$element['#attributes']['id'] = $element['#id'];
}
$variables['element']['#children'] = '<input' . drupal_attributes($element['#attributes']) . " />\n";
return theme('form_element', $variables);
}