Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
1f3e11d4
Commit
1f3e11d4
authored
May 01, 2010
by
webchick
Browse files
#783438
by sun: Fixed #states doesn't work for #type item.
parent
fede1c11
Changes
1
Show whitespace changes
Inline
Side-by-side
includes/form.inc
View file @
1f3e11d4
...
...
@@ -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>'
:
''
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment