_forum_get_vid

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

modules/forum/forum.module, строка 654

Версии
5
_forum_get_vid()

Returns the vocabulary id for forum navigation.

▾ 9 функции вызывают _forum_get_vid()

forum_form in modules/forum/forum.module
Реализация hook_form().
forum_form_alter in modules/forum/forum.module
Implementation of hook_form_alter().
forum_form_container in modules/forum/forum.module
Returns a form for adding a container to the forum vocabulary
forum_form_forum in modules/forum/forum.module
Returns a form for adding a forum to the forum vocabulary
forum_overview in modules/forum/forum.module
Returns an overview list of existing forums and containers
forum_prepare in modules/forum/forum.module
Implementation of hook_prepare; assign forum taxonomy when adding a topic from within a forum.
forum_submit in modules/forum/forum.module
Implementation of hook_submit().
forum_taxonomy in modules/forum/forum.module
Implementation of hook_taxonomy().
_forum_parent_select in modules/forum/forum.module
Returns a select box for available parent terms

Код

<?php
function _forum_get_vid() {
  $vid = variable_get('forum_nav_vocabulary', '');
  if (empty($vid)) {
    // Check to see if a forum vocabulary exists
    $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s'", 'forum'));
    if (!$vid) {
      // Create the forum vocabulary. Assign the vocabulary a low weight so
      // it will appear first in forum topic create and edit forms.
      $edit = array('name' => t('Forums'), 'multiple' => 0, 'required' => 1, 'hierarchy' => 1, 'relations' => 0, 'module' => 'forum', 'weight' => -10, 'nodes' => array('forum' => 1));
      taxonomy_save_vocabulary($edit);
      $vid = $edit['vid'];
    }
    variable_set('forum_nav_vocabulary', $vid);
  }

  return $vid;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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