summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-05-01 00:19:35 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-05-01 00:19:35 +0000
commit1f3e11d44cc0849b4478a42cd52bac4e4808d75f (patch)
tree754d469d2add341b89731438f0b93f083eba4817
parentfede1c118224b3fd0a91006a5dc89084086e3154 (diff)
downloadbrdo-1f3e11d44cc0849b4478a42cd52bac4e4808d75f.tar.gz
brdo-1f3e11d44cc0849b4478a42cd52bac4e4808d75f.tar.bz2
#783438 by sun: Fixed #states doesn't work for #type item.
-rw-r--r--includes/form.inc14
1 files changed, 8 insertions, 6 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 06aa05067..cd039d647 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -3029,22 +3029,24 @@ function theme_form_element($variables) {
// This is also used in the installer, pre-database setup.
$t = get_t();
+ // Add element #id for #type 'item'.
+ if (isset($element['#markup']) && !empty($element['#id'])) {
+ $attributes['id'] = $element['#id'];
+ }
// Add element's #type and #name as class to aid with JS/CSS selectors.
- $class = array('form-item');
+ $attributes['class'] = array('form-item');
if (!empty($element['#type'])) {
- $class[] = 'form-type-' . strtr($element['#type'], '_', '-');
+ $attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
}
if (!empty($element['#name'])) {
- $class[] = 'form-item-' . strtr($element['#name'], array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
+ $attributes['class'][] = 'form-item-' . strtr($element['#name'], array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
}
+ $output = '<div' . drupal_attributes($attributes) . '>' . "\n";
// If #title is not set, we don't display any label or required marker.
if (!isset($element['#title'])) {
$element['#title_display'] = 'none';
}
-
- $output = '<div class="' . implode(' ', $class) . '">' . "\n";
-
$prefix = isset($element['#field_prefix']) ? '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ' : '';
$suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>' : '';