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
153fbc78
Commit
153fbc78
authored
Aug 24, 2006
by
drumm
Browse files
#79732
by drewish, fix the taxonomy forms and some code cleanup.
parent
849a10fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/taxonomy/taxonomy.module
View file @
153fbc78
...
...
@@ -75,7 +75,8 @@ function taxonomy_menu($may_cache) {
$items
[]
=
array
(
'path'
=>
'admin/content/taxonomy/add/vocabulary'
,
'title'
=>
t
(
'add vocabulary'
),
'callback'
=>
'taxonomy_admin_vocabulary_edit'
,
'callback'
=>
'drupal_get_form'
,
'callback arguments'
=>
array
(
'taxonomy_form_vocabulary'
),
'access'
=>
user_access
(
'administer taxonomy'
),
'type'
=>
MENU_LOCAL_TASK
);
...
...
@@ -105,22 +106,23 @@ function taxonomy_menu($may_cache) {
}
else
{
if
(
is_numeric
(
arg
(
3
)))
{
$items
[]
=
array
(
'path'
=>
'admin/content/taxonomy/'
.
arg
(
3
),
$vid
=
arg
(
3
);
$items
[]
=
array
(
'path'
=>
'admin/content/taxonomy/'
.
$vid
,
'title'
=>
t
(
'list terms'
),
'callback'
=>
'taxonomy_overview_terms'
,
'callback arguments'
=>
array
(
arg
(
3
)
),
'callback arguments'
=>
array
(
$vid
),
'access'
=>
user_access
(
'administer taxonomy'
),
'type'
=>
MENU_CALLBACK
);
$items
[]
=
array
(
'path'
=>
'admin/content/taxonomy/'
.
arg
(
3
)
.
'/list'
,
$items
[]
=
array
(
'path'
=>
'admin/content/taxonomy/'
.
$vid
.
'/list'
,
'title'
=>
t
(
'list'
),
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
'weight'
=>
-
10
);
$items
[]
=
array
(
'path'
=>
'admin/content/taxonomy/'
.
arg
(
3
)
.
'/add/term'
,
$items
[]
=
array
(
'path'
=>
'admin/content/taxonomy/'
.
$vid
.
'/add/term'
,
'title'
=>
t
(
'add term'
),
'callback'
=>
'
taxonomy_form_te
rm'
,
'callback arguments'
=>
array
(
array
(
'vid'
=>
arg
(
3
))
),
'callback'
=>
'
drupal_get_fo
rm'
,
'callback arguments'
=>
array
(
'taxonomy_form_term'
,
$vid
),
'access'
=>
user_access
(
'administer taxonomy'
),
'type'
=>
MENU_LOCAL_TASK
);
}
...
...
@@ -165,6 +167,9 @@ function taxonomy_overview_terms($vid) {
$header
=
array
(
t
(
'Name'
),
t
(
'Operations'
));
$vocabulary
=
taxonomy_get_vocabulary
(
$vid
);
if
(
!
$vocabulary
)
{
return
drupal_not_found
();
}
drupal_set_title
(
check_plain
(
$vocabulary
->
name
));
$start_from
=
$_GET
[
'page'
]
?
$_GET
[
'page'
]
:
0
;
...
...
@@ -336,7 +341,8 @@ function taxonomy_vocabulary_confirm_delete($vid) {
return
confirm_form
(
$form
,
t
(
'Are you sure you want to delete the vocabulary %title?'
,
array
(
'%title'
=>
$vocabulary
->
name
)),
'admin/content/taxonomy'
,
t
(
'Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'
),
'admin/content/taxonomy'
,
t
(
'Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'
),
t
(
'Delete'
),
t
(
'Cancel'
));
}
...
...
@@ -347,8 +353,7 @@ function taxonomy_vocabulary_confirm_delete_submit($form_id, $form_values) {
return
'admin/content/taxonomy'
;
}
function
taxonomy_form_term
(
$edit
=
array
())
{
$vocabulary_id
=
isset
(
$edit
[
'vid'
])
?
$edit
[
'vid'
]
:
arg
(
4
);
function
taxonomy_form_term
(
$vocabulary_id
,
$edit
=
array
())
{
$vocabulary
=
taxonomy_get_vocabulary
(
$vocabulary_id
);
$form
[
'name'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Term name'
),
'#default_value'
=>
$edit
[
'name'
],
'#maxlength'
=>
64
,
'#description'
=>
t
(
'The name for this term. Example: "Linux".'
),
'#required'
=>
TRUE
);
...
...
@@ -1276,29 +1281,29 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') {
}
/**
* Page to
add or
edit a vocabulary
* Page to edit a vocabulary
*/
function
taxonomy_admin_vocabulary_edit
(
$vid
=
NULL
)
{
if
(
$_POST
[
'op'
]
==
t
(
'Delete'
)
||
$_POST
[
'edit'
][
'confirm'
])
{
return
taxonomy_vocabulary_confirm_delete
(
$vid
);
return
drupal_get_form
(
'
taxonomy_vocabulary_confirm_delete
'
,
$vid
);
}
else
if
(
$vid
)
{
$vocabulary
=
(
array
)
taxonomy_
get
_vocabulary
(
$vid
);
if
(
$vocabulary
=
(
array
)
taxonomy_get_vocabulary
(
$vid
)
)
{
return
drupal_get_form
(
'
taxonomy_
form
_vocabulary
'
,
$vocabulary
);
}
return
drupal_
get_form
(
'taxonomy_form_vocabulary'
,
$vocabulary
);
return
drupal_
not_found
(
);
}
/**
* Page to
list terms for
a vocabulary
* Page to
edit
a vocabulary
term
*/
function
taxonomy_admin_term_edit
(
$tid
=
NULL
)
{
function
taxonomy_admin_term_edit
(
$tid
)
{
if
(
$_POST
[
'op'
]
==
t
(
'Delete'
)
||
$_POST
[
'edit'
][
'confirm'
])
{
return
taxonomy_term_confirm_delete
(
$tid
);
return
drupal_get_form
(
'
taxonomy_term_confirm_delete
'
,
$tid
);
}
else
if
(
$tid
)
{
$term
=
(
array
)
taxonomy_
get
_term
(
$tid
);
if
(
$term
=
(
array
)
taxonomy_get_term
(
$tid
)
)
{
return
drupal_get_form
(
'
taxonomy_
form
_term
'
,
$term
->
vid
,
$term
);
}
return
taxonomy_form_term
(
$term
);
return
drupal_not_found
(
);
}
/**
...
...
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