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
bd4fe6ed
Commit
bd4fe6ed
authored
Dec 16, 2005
by
Dries
Browse files
- Patch
#40813
: Taxonomy forms should be in a fieldset.
parent
b6dba6fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/form.inc
View file @
bd4fe6ed
...
...
@@ -414,6 +414,7 @@ function _element_info($type, $refresh = null) {
*/
function
theme_select
(
$element
)
{
$select
=
''
;
$size
=
$element
[
'#size'
]
?
' size="'
.
$element
[
'#size'
]
.
'"'
:
''
;
foreach
(
$element
[
'#options'
]
as
$key
=>
$choice
)
{
if
(
is_array
(
$choice
))
{
$select
.
=
'<optgroup label="'
.
$key
.
'">'
;
...
...
@@ -426,7 +427,7 @@ function theme_select($element) {
$select
.
=
'<option value="'
.
$key
.
'"'
.
(
is_array
(
$element
[
'#value'
])
?
(
in_array
(
$key
,
$element
[
'#value'
])
?
' selected="selected"'
:
''
)
:
(
$element
[
'#value'
]
==
$key
?
' selected="selected"'
:
''
))
.
'>'
.
check_plain
(
$choice
)
.
'</option>'
;
}
}
return
theme
(
'form_element'
,
$element
[
'#title'
],
'<select name="'
.
$element
[
'#name'
]
.
''
.
(
$element
[
'#multiple'
]
?
'[]'
:
''
)
.
'"'
.
(
$element
[
'#multiple'
]
?
' multiple="multiple" '
:
''
)
.
drupal_attributes
(
$element
[
'#attributes'
])
.
' id="'
.
$element
[
'#id'
]
.
'">'
.
$select
.
'</select>'
,
$element
[
'#description'
],
$element
[
'#id'
],
$element
[
'#required'
],
form_get_error
(
$element
));
return
theme
(
'form_element'
,
$element
[
'#title'
],
'<select name="'
.
$element
[
'#name'
]
.
''
.
(
$element
[
'#multiple'
]
?
'[]'
:
''
)
.
'"'
.
(
$element
[
'#multiple'
]
?
' multiple="multiple" '
:
''
)
.
drupal_attributes
(
$element
[
'#attributes'
])
.
' id="'
.
$element
[
'#id'
]
.
'"
'
.
$size
.
'
>'
.
$select
.
'</select>'
,
$element
[
'#description'
],
$element
[
'#id'
],
$element
[
'#required'
],
form_get_error
(
$element
));
}
/**
...
...
modules/taxonomy.module
View file @
bd4fe6ed
...
...
@@ -533,11 +533,11 @@ function taxonomy_form_alter($form_id, &$form) {
else
{
$ntterms
=
isset
(
$node
->
taxonomy
)
?
$terms
:
array_keys
(
$terms
);
$form
[
'taxonomy'
][
$vocabulary
->
vid
]
=
taxonomy_form
(
$vocabulary
->
vid
,
$ntterms
,
$help
,
'taxonomy'
);
$form
[
'taxonomy'
][
$vocabulary
->
vid
][
'#weight'
]
=
$vocabulary
->
weight
;
}
}
if
(
isset
(
$form
[
'taxonomy'
]))
{
$form
[
'taxonomy'
][
'#tree'
]
=
TRUE
;
$form
[
'taxonomy'
][
'#weight'
]
=
$vocabulary
->
weight
;
$form
[
'taxonomy'
]
=
array_merge
(
$form
[
'taxonomy'
],
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Categories'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
FALSE
,
'#tree'
=>
TRUE
,
'#weight'
=>
-
3
));
}
}
}
...
...
@@ -914,7 +914,7 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti
$value
=
$tree
[
0
]
->
tid
;
}
}
return
array
(
'#type'
=>
'select'
,
'#title'
=>
$title
,
'#default_value'
=>
$value
,
'#options'
=>
$options
,
'#description'
=>
$description
,
'#multiple'
=>
$multiple
,
'#size'
=>
$multiple
?
'size="'
.
min
(
12
,
count
(
$options
))
.
'"'
:
0
,
'#weight'
=>
-
15
,
'#theme'
=>
'taxonomy_term_select'
);
return
array
(
'#type'
=>
'select'
,
'#title'
=>
$title
,
'#default_value'
=>
$value
,
'#options'
=>
$options
,
'#description'
=>
$description
,
'#multiple'
=>
$multiple
,
'#size'
=>
$multiple
?
min
(
9
,
count
(
$options
))
:
0
,
'#weight'
=>
-
15
,
'#theme'
=>
'taxonomy_term_select'
);
}
function
theme_taxonomy_term_select
(
$element
)
{
...
...
modules/taxonomy/taxonomy.module
View file @
bd4fe6ed
...
...
@@ -533,11 +533,11 @@ function taxonomy_form_alter($form_id, &$form) {
else
{
$ntterms
=
isset
(
$node
->
taxonomy
)
?
$terms
:
array_keys
(
$terms
);
$form
[
'taxonomy'
][
$vocabulary
->
vid
]
=
taxonomy_form
(
$vocabulary
->
vid
,
$ntterms
,
$help
,
'taxonomy'
);
$form
[
'taxonomy'
][
$vocabulary
->
vid
][
'#weight'
]
=
$vocabulary
->
weight
;
}
}
if
(
isset
(
$form
[
'taxonomy'
]))
{
$form
[
'taxonomy'
][
'#tree'
]
=
TRUE
;
$form
[
'taxonomy'
][
'#weight'
]
=
$vocabulary
->
weight
;
$form
[
'taxonomy'
]
=
array_merge
(
$form
[
'taxonomy'
],
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Categories'
),
'#collapsible'
=>
TRUE
,
'#collapsed'
=>
FALSE
,
'#tree'
=>
TRUE
,
'#weight'
=>
-
3
));
}
}
}
...
...
@@ -914,7 +914,7 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti
$value
=
$tree
[
0
]
->
tid
;
}
}
return
array
(
'#type'
=>
'select'
,
'#title'
=>
$title
,
'#default_value'
=>
$value
,
'#options'
=>
$options
,
'#description'
=>
$description
,
'#multiple'
=>
$multiple
,
'#size'
=>
$multiple
?
'size="'
.
min
(
12
,
count
(
$options
))
.
'"'
:
0
,
'#weight'
=>
-
15
,
'#theme'
=>
'taxonomy_term_select'
);
return
array
(
'#type'
=>
'select'
,
'#title'
=>
$title
,
'#default_value'
=>
$value
,
'#options'
=>
$options
,
'#description'
=>
$description
,
'#multiple'
=>
$multiple
,
'#size'
=>
$multiple
?
min
(
9
,
count
(
$options
))
:
0
,
'#weight'
=>
-
15
,
'#theme'
=>
'taxonomy_term_select'
);
}
function
theme_taxonomy_term_select
(
$element
)
{
...
...
Write
Preview
Supports
Markdown
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