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
7cd54567
Commit
7cd54567
authored
Jun 04, 2004
by
Kjartan
Browse files
- Commiting patch
#8288
: Let modules pass $attributes to form_checkboxes() and form_radios().
parent
c957fe0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/common.inc
View file @
7cd54567
...
...
@@ -1034,11 +1034,11 @@ function form_radio($title, $name, $value = 1, $checked = 0, $description = NULL
return
theme
(
'form_element'
,
NULL
,
$element
,
$description
,
$required
,
_form_get_error
(
$name
));
}
function
form_radios
(
$title
,
$name
,
$value
,
$options
,
$description
=
NULL
,
$required
=
FALSE
)
{
function
form_radios
(
$title
,
$name
,
$value
,
$options
,
$description
=
NULL
,
$required
=
FALSE
,
$attributes
=
NULL
)
{
if
(
count
(
$options
)
>
0
)
{
$choices
=
''
;
foreach
(
$options
as
$key
=>
$choice
)
{
$choices
.
=
"<label class=
\"
option
\"
><input type=
\"
radio
\"
class=
\"
form-radio
\"
name=
\"
edit[
$name
]
\"
value=
\"
$key
\"
"
.
(
$key
==
$value
?
" checked=
\"
checked
\"
"
:
""
)
.
" />
$choice
</label><br />"
;
$choices
.
=
"<label class=
\"
option
\"
><input type=
\"
radio
\"
class=
\"
form-radio
\"
name=
\"
edit[
$name
]
\"
value=
\"
$key
\"
"
.
(
$key
==
$value
?
" checked=
\"
checked
\"
"
:
""
)
.
drupal_attributes
(
$attributes
)
.
" />
$choice
</label><br />"
;
}
return
theme
(
'form_element'
,
$title
,
$choices
,
$description
,
$required
,
_form_get_error
(
$name
));
}
...
...
@@ -1052,14 +1052,14 @@ function form_checkbox($title, $name, $value = 1, $checked = 0, $description = N
return
form_hidden
(
$name
,
0
)
.
theme
(
'form_element'
,
NULL
,
$element
,
$description
,
$required
,
_form_get_error
(
$name
));
}
function
form_checkboxes
(
$title
,
$name
,
$values
,
$options
,
$description
=
NULL
,
$required
=
FALSE
)
{
function
form_checkboxes
(
$title
,
$name
,
$values
,
$options
,
$description
=
NULL
,
$required
=
FALSE
,
$attributes
=
NULL
)
{
if
(
count
(
$options
)
>
0
)
{
if
(
!
isset
(
$values
))
{
$values
=
array
();
}
$choices
=
''
;
foreach
(
$options
as
$key
=>
$choice
)
{
$choices
.
=
"<label class=
\"
option
\"
><input type=
\"
checkbox
\"
class=
\"
form-checkbox
\"
name=
\"
edit[
$name
][]
\"
value=
\"
$key
\"
"
.
(
in_array
(
$key
,
$values
)
?
" checked=
\"
checked
\"
"
:
""
)
.
" />
$choice
</label><br />"
;
$choices
.
=
"<label class=
\"
option
\"
><input type=
\"
checkbox
\"
class=
\"
form-checkbox
\"
name=
\"
edit[
$name
][]
\"
value=
\"
$key
\"
"
.
(
in_array
(
$key
,
$values
)
?
" checked=
\"
checked
\"
"
:
""
)
.
drupal_attributes
(
$attributes
)
.
" />
$choice
</label><br />"
;
}
return
theme
(
'form_element'
,
$title
,
$choices
,
$description
,
$required
,
_form_get_error
(
$name
));
}
...
...
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