function theme_itoggle_wrapper in iToggle 7.3
Theme callback.
See also
File
- ./
itoggle.module, line 93 - iToggle module.
Code
function theme_itoggle_wrapper($variables) {
$element =& $variables['element'];
$display_types = array(
'yesno',
'onoff',
'onezero',
);
if (!in_array($element['#itoggle_type'], $display_types)) {
$element['#itoggle_type'] = 'yesno';
}
// This function is invoked as theme wrapper, but the rendered form element
// may not necessarily have been processed by form_builder().
$element += array(
'#title_display' => 'before',
);
$attributes['id'] = $element['#id'];
// Add element's #type and #name as class to aid with JS/CSS selectors
$attributes['class'] = array(
'form-item',
'itoggle-wrapper',
"itoggle-display-{$element['#itoggle_type']}",
);
if (!empty($element['#type'])) {
$attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
}
if (!empty($element['#name'])) {
$attributes['class'][] = 'form-item-' . strtr($element['#name'], array(
' ' => '-',
'_' => '-',
'[' => '-',
']' => '',
));
}
// Add a class for disabled elements to facilitate cross-browser styling.
if (!empty($element['#attributes']['disabled'])) {
$attributes['class'][] = 'form-disabled';
}
$output = '<div' . drupal_attributes($attributes) . '>' . "\n";
$output .= $element['#children'];
if (!empty($element['#description'])) {
$output .= '<div class="description">' . $element['#description'] . "</div>\n";
}
$output .= "</div>\n";
return $output;
}