- Patch #19621 by Morbus/drumm: fixed bugs with taxonomy_save_xxx() functions.

TODO: update image module too?
4.7.x
Dries Buytaert 2005-07-18 19:31:16 +00:00
parent a2389f12ac
commit 87e5399a9e
4 changed files with 22 additions and 18 deletions

View File

@ -94,7 +94,7 @@ function forum_admin() {
$edit['name'] = 0;
}
case t('Submit'):
$status = taxonomy_save_term($edit);
list($status, $object) = array_values(taxonomy_save_term($edit));
if (arg(3) == 'container') {
$containers = variable_get('forum_containers', array());
$containers[] = $edit['tid'];
@ -290,8 +290,8 @@ function _forum_get_vid() {
// Check to see if a forum vocabulary exists
$vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module='%s'", 'forum'));
if (!$vid) {
$vocabulary = taxonomy_save_vocabulary(array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum')));
$vid = $vocabulary['vid'];
list($status, $object) = array_values(taxonomy_save_vocabulary(array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum'))));
$vid = $object['vid'];
}
variable_set('forum_nav_vocabulary', $vid);
}

View File

@ -94,7 +94,7 @@ function forum_admin() {
$edit['name'] = 0;
}
case t('Submit'):
$status = taxonomy_save_term($edit);
list($status, $object) = array_values(taxonomy_save_term($edit));
if (arg(3) == 'container') {
$containers = variable_get('forum_containers', array());
$containers[] = $edit['tid'];
@ -290,8 +290,8 @@ function _forum_get_vid() {
// Check to see if a forum vocabulary exists
$vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module='%s'", 'forum'));
if (!$vid) {
$vocabulary = taxonomy_save_vocabulary(array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum')));
$vid = $vocabulary['vid'];
list($status, $object) = array_values(taxonomy_save_vocabulary(array('name' => 'Forums', 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'nodes' => array('forum'))));
$vid = $object['vid'];
}
variable_set('forum_nav_vocabulary', $vid);
}

View File

@ -163,7 +163,7 @@ function taxonomy_save_vocabulary($edit) {
cache_clear_all();
return $status;
return array('status' => $status, 'object' => $edit);
}
function taxonomy_del_vocabulary($vid) {
@ -301,7 +301,7 @@ function taxonomy_save_term($edit) {
cache_clear_all();
return $status;
return array('status' => $status, 'object' => $edit);
}
function taxonomy_del_term($tid) {
@ -617,8 +617,8 @@ function taxonomy_node_save($nid, $terms) {
}
if (!$typed_term_tid) {
$new_term = taxonomy_save_term(array('vid' => $vid, 'name' => $typed_term));
$typed_term_tid = $new_term['tid'];
list($status, $object) = array_values(taxonomy_save_term(array('vid' => $vid, 'name' => $typed_term)));
$typed_term_tid = $object['tid'];
}
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $typed_term_tid);
@ -1169,7 +1169,8 @@ function taxonomy_admin() {
}
case t('Submit'):
if (arg(3) == 'vocabulary') {
switch (taxonomy_save_vocabulary($edit)) {
list($status, $object) = array_values(taxonomy_save_vocabulary($edit));
switch ($status) {
case SAVED_NEW:
drupal_set_message(t('Created new vocabulary %name.', array('%name' => theme('placeholder', $edit['name']))));
break;
@ -1182,7 +1183,8 @@ function taxonomy_admin() {
}
}
else {
switch (taxonomy_save_term($edit)) {
list($status, $object) = array_values(taxonomy_save_term($edit));
switch ($status) {
case SAVED_NEW:
drupal_set_message(t('Created new term %term.', array('%term' => theme('placeholder', $edit['name']))));
break;

View File

@ -163,7 +163,7 @@ function taxonomy_save_vocabulary($edit) {
cache_clear_all();
return $status;
return array('status' => $status, 'object' => $edit);
}
function taxonomy_del_vocabulary($vid) {
@ -301,7 +301,7 @@ function taxonomy_save_term($edit) {
cache_clear_all();
return $status;
return array('status' => $status, 'object' => $edit);
}
function taxonomy_del_term($tid) {
@ -617,8 +617,8 @@ function taxonomy_node_save($nid, $terms) {
}
if (!$typed_term_tid) {
$new_term = taxonomy_save_term(array('vid' => $vid, 'name' => $typed_term));
$typed_term_tid = $new_term['tid'];
list($status, $object) = array_values(taxonomy_save_term(array('vid' => $vid, 'name' => $typed_term)));
$typed_term_tid = $object['tid'];
}
db_query('INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)', $nid, $typed_term_tid);
@ -1169,7 +1169,8 @@ function taxonomy_admin() {
}
case t('Submit'):
if (arg(3) == 'vocabulary') {
switch (taxonomy_save_vocabulary($edit)) {
list($status, $object) = array_values(taxonomy_save_vocabulary($edit));
switch ($status) {
case SAVED_NEW:
drupal_set_message(t('Created new vocabulary %name.', array('%name' => theme('placeholder', $edit['name']))));
break;
@ -1182,7 +1183,8 @@ function taxonomy_admin() {
}
}
else {
switch (taxonomy_save_term($edit)) {
list($status, $object) = array_values(taxonomy_save_term($edit));
switch ($status) {
case SAVED_NEW:
drupal_set_message(t('Created new term %term.', array('%term' => theme('placeholder', $edit['name']))));
break;