You are here

function tft_check_vocabulary_setting in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 tft.module \tft_check_vocabulary_setting()

Check that a valid vocabulary vid is set in the settings. Else, redirect to either the settings page (if the user has access) or the home page.

7 calls to tft_check_vocabulary_setting()
tft in ./tft.pages.inc
Menu callback function the file explorer
tft_add_term_form in ./tft.admin.inc
Add a term form.
tft_archive_file_form in ./tft.admin.inc
Archive a term form
tft_archive_term_form in ./tft.admin.inc
Archive a term form
tft_delete_term_form in ./tft.admin.inc
Delete a term form

... See full list

File

./tft.module, line 1312
Module hooks.

Code

function tft_check_vocabulary_setting() {
  if (!variable_get('tft_vocabulary_vid', 0) || !db_query("SELECT COUNT(vid) FROM {taxonomy_vocabulary} WHERE vid = :vid", array(
    ':vid' => variable_get('tft_vocabulary_vid', 0),
  ))
    ->fetchField()) {
    drupal_set_message(t("You must first enter which vocabulary is used by Taxonomy File Tree."), 'error');
    watchdog('tft', "TFT isn't properly configured. A valid vocabulary must be set as the TFT vocabulary.", array(), WATCHDOG_ERROR);
    if (user_access(TFT_ADMIN)) {
      drupal_goto('admin/settings/tft');
    }
    else {
      drupal_goto();
    }
  }
}