function theme_webform_inline_radio_label in Webform 7.4
Replacement for theme_form_element_label()
This varies from theme_element_label in that it allows inline fields such as select and input tags within the label itself.
1 theme call to theme_webform_inline_radio_label()
- theme_webform_inline_radio in ./
webform.module - Theme a radio button and another element together.
File
- ./
webform.module, line 3936 - This module provides a simple way to create forms and questionnaires.
Code
function theme_webform_inline_radio_label($variables) {
$element = $variables['element'];
// This is also used in the installer, pre-database setup.
$t = get_t();
// If title and required marker are both empty, output no label.
if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
return '';
}
// If the element is required, a required marker is appended to the label.
$required = !empty($element['#required']) ? theme('form_required_marker', array(
'element' => $element,
)) : '';
// theme_element_label() does a filter_xss() here, we skip it because we know
// every use where this theme function is used and we need to allow input and
// select elements.
$title = $element['#title'];
$attributes = isset($element['#attributes']) ? $element['#attributes'] : array();
// Style the label as class option to display inline with the element.
if ($element['#title_display'] == 'after') {
$attributes['class'][] = 'option';
}
elseif ($element['#title_display'] == 'invisible') {
$attributes['class'][] = 'element-invisible';
}
$attributes['class'][] = 'webform-inline-radio';
if (!empty($element['#id'])) {
$attributes['for'] = $element['#id'];
}
// The leading whitespace helps visually separate fields from inline labels.
return ' <label' . drupal_attributes($attributes) . '>' . $t('!title !required', array(
'!title' => $title,
'!required' => $required,
)) . "</label>\n";
}