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
be0b774c
Commit
be0b774c
authored
Apr 06, 2006
by
Steven Wittens
Browse files
-
#57523
: Make taxonomy delete vocabulary consistent with other taxonomy hook ops
parent
ec04325b
Changes
4
Hide whitespace changes
Inline
Side-by-side
modules/forum.module
View file @
be0b774c
...
...
@@ -149,10 +149,10 @@ function forum_nodeapi(&$node, $op, $teaser, $page) {
* Implementation of hook_taxonomy().
*/
function
forum_taxonomy
(
$op
,
$type
,
$term
=
NULL
)
{
if
(
$op
==
'delete'
&&
$term
->
vid
==
_forum_get_vid
())
{
if
(
$op
==
'delete'
&&
$term
[
'
vid
'
]
==
_forum_get_vid
())
{
switch
(
$type
)
{
case
'term'
:
$results
=
db_query
(
'SELECT f.nid FROM {forum} f WHERE f.tid = %d'
,
$term
->
tid
);
$results
=
db_query
(
'SELECT f.nid FROM {forum} f WHERE f.tid = %d'
,
$term
[
'
tid
'
]
);
while
(
$node
=
db_fetch_object
(
$results
))
{
// node_delete will also remove any association with non-forum vocabularies.
node_delete
(
$node
->
nid
);
...
...
@@ -160,7 +160,7 @@ function forum_taxonomy($op, $type, $term = NULL) {
// For containers, remove the tid from the forum_containers variable.
$containers
=
variable_get
(
'forum_containers'
,
array
());
if
(
$key
=
array_search
(
$term
->
tid
,
$containers
))
{
if
(
$key
=
array_search
(
$term
[
'
tid
'
]
,
$containers
))
{
unset
(
$containers
[
$key
]);
}
variable_set
(
'forum_containers'
,
$containers
);
...
...
modules/forum/forum.module
View file @
be0b774c
...
...
@@ -149,10 +149,10 @@ function forum_nodeapi(&$node, $op, $teaser, $page) {
* Implementation of hook_taxonomy().
*/
function
forum_taxonomy
(
$op
,
$type
,
$term
=
NULL
)
{
if
(
$op
==
'delete'
&&
$term
->
vid
==
_forum_get_vid
())
{
if
(
$op
==
'delete'
&&
$term
[
'
vid
'
]
==
_forum_get_vid
())
{
switch
(
$type
)
{
case
'term'
:
$results
=
db_query
(
'SELECT f.nid FROM {forum} f WHERE f.tid = %d'
,
$term
->
tid
);
$results
=
db_query
(
'SELECT f.nid FROM {forum} f WHERE f.tid = %d'
,
$term
[
'
tid
'
]
);
while
(
$node
=
db_fetch_object
(
$results
))
{
// node_delete will also remove any association with non-forum vocabularies.
node_delete
(
$node
->
nid
);
...
...
@@ -160,7 +160,7 @@ function forum_taxonomy($op, $type, $term = NULL) {
// For containers, remove the tid from the forum_containers variable.
$containers
=
variable_get
(
'forum_containers'
,
array
());
if
(
$key
=
array_search
(
$term
->
tid
,
$containers
))
{
if
(
$key
=
array_search
(
$term
[
'
tid
'
]
,
$containers
))
{
unset
(
$containers
[
$key
]);
}
variable_set
(
'forum_containers'
,
$containers
);
...
...
modules/taxonomy.module
View file @
be0b774c
...
...
@@ -121,7 +121,7 @@ function taxonomy_menu($may_cache) {
* List and manage vocabularies.
*/
function
taxonomy_overview_vocabularies
()
{
$vocabularies
=
taxonomy_get_vocabularies
();
$vocabularies
=
taxonomy_get_vocabularies
();
foreach
(
$vocabularies
as
$vocabulary
)
{
$types
=
array
();
foreach
(
$vocabulary
->
nodes
as
$type
)
{
...
...
@@ -133,7 +133,7 @@ function taxonomy_overview_vocabularies() {
$form
[
$vocabulary
->
vid
][
'edit'
]
=
array
(
'#value'
=>
l
(
t
(
'edit vocabulary'
),
"admin/taxonomy/edit/vocabulary/
$vocabulary->vid
"
));
$form
[
$vocabulary
->
vid
][
'list'
]
=
array
(
'#value'
=>
l
(
t
(
'list terms'
),
"admin/taxonomy/
$vocabulary->vid
"
));
}
return
drupal_get_form
(
'taxonomy_overview_vocabularies'
,
$form
);
}
...
...
@@ -156,7 +156,7 @@ function theme_taxonomy_overview_vocabularies($form) {
$rows
[]
=
array
(
array
(
'data'
=>
t
(
'No categories available.'
),
'colspan'
=>
'4'
,
'class'
=>
'message'
));
}
$header
=
array
(
t
(
'Name'
),
t
(
'Type'
),
array
(
'data'
=>
t
(
'Operations'
),
'colspan'
=>
'2'
));
$output
=
theme
(
'table'
,
$header
,
$rows
,
array
(
'id'
=>
'taxonomy'
));
$output
.
=
form_render
(
$form
);
return
$output
;
...
...
@@ -509,7 +509,7 @@ function taxonomy_del_term($tid) {
}
}
$term
=
taxonomy_get_term
(
$tid
);
$term
=
(
array
)
taxonomy_get_term
(
$tid
);
db_query
(
'DELETE FROM {term_data} WHERE tid = %d'
,
$tid
);
db_query
(
'DELETE FROM {term_hierarchy} WHERE tid = %d'
,
$tid
);
...
...
modules/taxonomy/taxonomy.module
View file @
be0b774c
...
...
@@ -121,7 +121,7 @@ function taxonomy_menu($may_cache) {
* List and manage vocabularies.
*/
function
taxonomy_overview_vocabularies
()
{
$vocabularies
=
taxonomy_get_vocabularies
();
$vocabularies
=
taxonomy_get_vocabularies
();
foreach
(
$vocabularies
as
$vocabulary
)
{
$types
=
array
();
foreach
(
$vocabulary
->
nodes
as
$type
)
{
...
...
@@ -133,7 +133,7 @@ function taxonomy_overview_vocabularies() {
$form
[
$vocabulary
->
vid
][
'edit'
]
=
array
(
'#value'
=>
l
(
t
(
'edit vocabulary'
),
"admin/taxonomy/edit/vocabulary/
$vocabulary->vid
"
));
$form
[
$vocabulary
->
vid
][
'list'
]
=
array
(
'#value'
=>
l
(
t
(
'list terms'
),
"admin/taxonomy/
$vocabulary->vid
"
));
}
return
drupal_get_form
(
'taxonomy_overview_vocabularies'
,
$form
);
}
...
...
@@ -156,7 +156,7 @@ function theme_taxonomy_overview_vocabularies($form) {
$rows
[]
=
array
(
array
(
'data'
=>
t
(
'No categories available.'
),
'colspan'
=>
'4'
,
'class'
=>
'message'
));
}
$header
=
array
(
t
(
'Name'
),
t
(
'Type'
),
array
(
'data'
=>
t
(
'Operations'
),
'colspan'
=>
'2'
));
$output
=
theme
(
'table'
,
$header
,
$rows
,
array
(
'id'
=>
'taxonomy'
));
$output
.
=
form_render
(
$form
);
return
$output
;
...
...
@@ -509,7 +509,7 @@ function taxonomy_del_term($tid) {
}
}
$term
=
taxonomy_get_term
(
$tid
);
$term
=
(
array
)
taxonomy_get_term
(
$tid
);
db_query
(
'DELETE FROM {term_data} WHERE tid = %d'
,
$tid
);
db_query
(
'DELETE FROM {term_hierarchy} WHERE tid = %d'
,
$tid
);
...
...
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