taxonomy_save_vocabulary

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/taxonomy/taxonomy.module, строка 196

Версии
5 – 6
taxonomy_save_vocabulary(&$edit)

▾ 7 функции вызывают taxonomy_save_vocabulary()

forum_enable in modules/forum/forum.install
forum_update_6000 in 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 modules/taxonomy/taxonomy.module
Dynamicly check and update the hierarachy flag of a vocabulary.
taxonomy_form_term_submit in modules/taxonomy/taxonomy.admin.inc
Обработчик кнопки "Отправить", формы добавления или обновления термина. См. также taxonomy_form_term()
taxonomy_form_vocabulary_submit in modules/taxonomy/taxonomy.admin.inc
Accept the form submission for a vocabulary and save the results.
taxonomy_overview_terms_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler for terms overview form.
taxonomy_overview_vocabularies_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler for vocabularies overview. Updates changed vocabulary weights. See alsotaxonomy_overview_vocabularies()

Код

<?php
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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему