Commit 3cf8a44f authored by Dries's avatar Dries

- Patch #667944 by sun: Javascript #states cannot hide fieldsets, radios, checkboxes.

parent 73fbc282
...@@ -2027,13 +2027,15 @@ function theme_radio($variables) { ...@@ -2027,13 +2027,15 @@ function theme_radio($variables) {
*/ */
function theme_radios($variables) { function theme_radios($variables) {
$element = $variables['element']; $element = $variables['element'];
$class = 'form-radios'; $attributes = array();
if (!empty($element['#id'])) {
$attributes['id'] = $element['#id'];
}
$attributes['class'] = 'form-radios';
if (!empty($element['#attributes']['class'])) { if (!empty($element['#attributes']['class'])) {
$class .= ' ' . implode(' ', $element['#attributes']['class']); $attributes['class'] .= ' ' . implode(' ', $element['#attributes']['class']);
} }
$element['#children'] = '<div class="' . $class . '">' . (!empty($element['#children']) ? $element['#children'] : '') . '</div>'; return '<div' . drupal_attributes($attributes) . '>' . (!empty($element['#children']) ? $element['#children'] : '') . '</div>';
return $element['#children'];
} }
/** /**
...@@ -2272,13 +2274,15 @@ function theme_checkbox($variables) { ...@@ -2272,13 +2274,15 @@ function theme_checkbox($variables) {
*/ */
function theme_checkboxes($variables) { function theme_checkboxes($variables) {
$element = $variables['element']; $element = $variables['element'];
$class = 'form-checkboxes'; $attributes = array();
if (!empty($element['#id'])) {
$attributes['id'] = $element['#id'];
}
$attributes['class'] = 'form-checkboxes';
if (!empty($element['#attributes']['class'])) { if (!empty($element['#attributes']['class'])) {
$class .= ' ' . implode(' ', $element['#attributes']['class']); $attributes['class'] .= ' ' . implode(' ', $element['#attributes']['class']);
} }
$element['#children'] = '<div class="' . $class . '">' . (!empty($element['#children']) ? $element['#children'] : '') . '</div>'; return '<div' . drupal_attributes($attributes) . '>' . (!empty($element['#children']) ? $element['#children'] : '') . '</div>';
return $element['#children'];
} }
/** /**
...@@ -2297,7 +2301,6 @@ function form_pre_render_conditional_form_element($element) { ...@@ -2297,7 +2301,6 @@ function form_pre_render_conditional_form_element($element) {
} }
if (isset($element['#title']) || isset($element['#description'])) { if (isset($element['#title']) || isset($element['#description'])) {
unset($element['#id']);
$element['#theme_wrappers'][] = 'form_element'; $element['#theme_wrappers'][] = 'form_element';
} }
return $element; return $element;
...@@ -2537,7 +2540,7 @@ function form_process_fieldset(&$element, &$form_state) { ...@@ -2537,7 +2540,7 @@ function form_process_fieldset(&$element, &$form_state) {
if (!isset($element['#attributes']['class'])) { if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = array(); $element['#attributes']['class'] = array();
} }
$element['#attributes']['class'][] = 'form-wrapper';
$element['#attributes']['class'][] = 'collapsible'; $element['#attributes']['class'][] = 'collapsible';
if (!empty($element['#collapsed'])) { if (!empty($element['#collapsed'])) {
$element['#attributes']['class'][] = 'collapsed'; $element['#attributes']['class'][] = 'collapsed';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment