function theme_supersized_form_element_label in Supersized 8
Same name and namespace in other branches
- 7 supersized.module \theme_supersized_form_element_label()
Theme function of supersized_form_element_label.
This is for avoid filtering out attributes of label.
1 theme call to theme_supersized_form_element_label()
- theme_supersized_form_element in ./
supersized.module - Theme function of supersized_form_element.
File
- ./
supersized.module, line 136 - Supersized module file.
Code
function theme_supersized_form_element_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,
)) : '';
$title = $element['#title'];
$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';
}
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";
}