You are here

function faq_categories_settings_form_submit in Frequently Asked Questions 6

Same name and namespace in other branches
  1. 7.2 faq.admin.inc \faq_categories_settings_form_submit()
  2. 7 faq.admin.inc \faq_categories_settings_form_submit()

Display an error if no valid FAQ vocabularies available.

1 string reference to 'faq_categories_settings_form_submit'
faq_categories_settings_form in ./faq.admin.inc
Define the elements for the FAQ Settings page - categories tab.

File

./faq.admin.inc, line 330
Administrative page callbacks for the faq module.

Code

function faq_categories_settings_form_submit($form, &$form_state) {
  if ($form_state['values']['faq_use_categories'] && isset($form_state['values']['faq_omit_vocabulary'])) {
    $vocabularies = taxonomy_get_vocabularies('faq');
    $vocab_omit = $form_state['values']['faq_omit_vocabulary'];
    $valid_vocab = FALSE;
    foreach ($vocabularies as $vid => $vobj) {
      if (empty($vocab_omit[$vid])) {
        $valid_vocab = TRUE;
      }
    }
    if (!$valid_vocab) {
      drupal_set_message(t('Categories are enabled but no vocabulary is associated with the FAQ content type. Either create a vocabulary or disable categorization in order for questions to appear.'), 'error');
    }
  }
}