function theme_webform_inline_radio in Webform 7.4
Same name and namespace in other branches
- 7.3 webform.module \theme_webform_inline_radio()
Theme a radio button and another element together.
This is used in the e-mail configuration to show a radio button and a text field or select list on the same line.
File
- ./
webform.module, line 3897 - This module provides a simple way to create forms and questionnaires.
Code
function theme_webform_inline_radio($variables) {
$element = $variables['element'];
// Add element's #type and #name as class to aid with JS/CSS selectors.
$class = array(
'form-item',
);
if (!empty($element['#type'])) {
$class[] = 'form-type-' . strtr($element['#type'], '_', '-');
}
if (!empty($element['#name'])) {
$class[] = 'form-item-' . strtr($element['#name'], array(
' ' => '-',
'_' => '-',
'[' => '-',
']' => '',
));
}
// Add container-inline to all elements.
$class[] = 'webform-container-inline';
if (isset($element['#inline_element']) && isset($variables['element']['#title'])) {
$variables['element']['#title'] .= ': ';
}
$output = '<div class="' . implode(' ', $class) . '">' . "\n";
$output .= ' ' . $element['#children'];
if (!empty($element['#title'])) {
$output .= ' ' . theme('webform_inline_radio_label', $variables) . "\n";
}
if (!empty($element['#description'])) {
$output .= ' <div class="description">' . $element['#description'] . "</div>\n";
}
$output .= "</div>\n";
return $output;
}