function taxonomy_save_vocabulary
6.x taxonomy.module | taxonomy_save_vocabulary(&$edit) |
7 calls to taxonomy_save_vocabulary()
- forum_enable in drupal-6.x/
modules/ forum/ forum.install - forum_update_6000 in drupal-6.x/
modules/ forum/ forum.install - Create the forum vocabulary if does not exist. Assign the vocabulary a low weight so it will appear first in forum topic create and edit forms. Do not just call forum_enable() because in future versions it might do something different.
- taxonomy_check_vocabulary_hierarchy in drupal-6.x/
modules/ taxonomy/ taxonomy.module - Dynamically check and update the hierarachy flag of a vocabulary. Checks and updates the hierarchy flag of a vocabulary.
- taxonomy_form_term_submit in drupal-6.x/
modules/ taxonomy/ taxonomy.admin.inc - Submit handler to insert or update a term.
- taxonomy_form_vocabulary_submit in drupal-6.x/
modules/ taxonomy/ taxonomy.admin.inc - Accept the form submission for a vocabulary and save the results.
File
- drupal-6.x/
modules/ taxonomy/ taxonomy.module, line 196 - Enables the organization of content into categories.
Code
function taxonomy_save_vocabulary(&$edit) {
$edit['nodes'] = empty($edit['nodes']) ? array() : $edit['nodes'];
if (!isset($edit['module'])) {
$edit['module'] = 'taxonomy';
}
if (!empty($edit['vid']) && !empty($edit['name'])) {
drupal_write_record('vocabulary', $edit, 'vid');
db_query("DELETE FROM {vocabulary_node_types} WHERE vid = %d", $edit['vid']);
foreach ($edit['nodes'] as $type => $selected) {
db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type);
}
module_invoke_all('taxonomy', 'update', 'vocabulary', $edit);
$status = SAVED_UPDATED;
}
else if (!empty($edit['vid'])) {
$status = taxonomy_del_vocabulary($edit['vid']);
}
else {
drupal_write_record('vocabulary', $edit);
foreach ($edit['nodes'] as $type => $selected) {
db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $edit['vid'], $type);
}
module_invoke_all('taxonomy', 'insert', 'vocabulary', $edit);
$status = SAVED_NEW;
}
cache_clear_all();
return $status;
}