function faq_categories_settings_form in Frequently Asked Questions 5
Same name and namespace in other branches
- 5.2 faq.module \faq_categories_settings_form()
- 6 faq.admin.inc \faq_categories_settings_form()
- 7.2 faq.admin.inc \faq_categories_settings_form()
- 7 faq.admin.inc \faq_categories_settings_form()
Define a form to edit the categories setup
1 string reference to 'faq_categories_settings_form'
- faq_menu in ./
faq.module - Implementation of hook_menu()
File
- ./
faq.module, line 351
Code
function faq_categories_settings_form() {
if (!module_exists("taxonomy")) {
drupal_set_message(t('Categorization of questions will not work without the "taxonomy" module being enabled.'), 'error');
}
drupal_add_js(drupal_get_path('module', 'faq') . '/faq.js', 'module');
// set up a hidden variable
$form['faq_display'] = array(
'#type' => 'hidden',
'#default_value' => variable_get('faq_display', 'questions_top'),
);
$form['faq_use_categories'] = array(
'#type' => 'checkbox',
'#title' => t('Categorize questions'),
'#description' => t('This allows the user to display the questions according to the categories configured on the add/edit FAQ page. Use of sub-categories is only recommended for large lists of questions. The Taxonomy module must be enabled.'),
'#default_value' => variable_get('faq_use_categories', FALSE),
);
$category_options['categories_inline'] = t('Categories inline');
$category_options['hide_qa'] = t('Clicking on category opens/hides questions and answers under category');
$category_options['new_page'] = t('Clicking on category opens the questions/answers in a new page');
$form['faq_category_display'] = array(
'#type' => 'radios',
'#options' => $category_options,
'#title' => t('Categories layout'),
'#description' => t('This controls now the categories are displayed on the page and what happens when someone clicks on the category.'),
'#default_value' => variable_get('faq_category_display', 'categories_inline'),
);
$form['faq_category_misc'] = array(
'#type' => 'fieldset',
'#title' => t('Miscellaneous layout settings'),
'#collapsible' => TRUE,
);
$form['faq_category_misc']['faq_category_listing'] = array(
'#type' => 'select',
'#options' => array(
'ol' => 'Ordered list',
'ul' => 'Unordered list',
),
'#title' => t('Categories listing style'),
'#description' => t("This allows to select how the categories listing is presented. It only applies to the 'Clicking on category opens the questions/answers in a new page' layout. An ordered listing would number the categories, whereas an unordered list will have a bullet to the left of each category."),
'#default_value' => variable_get('faq_category_listing', 'ul'),
);
$form['faq_category_misc']['faq_count'] = array(
'#type' => 'checkbox',
'#title' => t('Show FAQ count'),
'#description' => t('This displays the number of questions in a category after the category name.'),
'#default_value' => variable_get('faq_count', FALSE),
);
$form['faq_category_misc']['faq_answer_category_name'] = array(
'#type' => 'checkbox',
'#title' => t('Display category name for answers'),
'#description' => t("This allows the user to toggle the visibility of the category name above each answer section for the 'Clicking on question takes user to answer further down the page' question/answer display."),
'#default_value' => variable_get('faq_answer_category_name', FALSE),
);
$form['faq_category_misc']['faq_group_questions_top'] = array(
'#type' => 'checkbox',
'#title' => t("Group questions and answers for 'Categories inline'"),
'#description' => t("This controls how categories are implemented with the 'Clicking on question takes user to answer further down the page' question/answer display."),
'#default_value' => variable_get('faq_group_questions_top', FALSE),
);
$form['faq_category_misc']['faq_hide_sub_categories'] = array(
'#type' => 'checkbox',
'#title' => t("Only show sub-categories when parent category is selected"),
'#description' => t("This allows the user more control over how and when sub-categories are displayed. It does not affect the 'Categories inline' display."),
'#default_value' => variable_get('faq_hide_sub_categories', FALSE),
);
$form['faq_category_misc']['faq_show_cat_sub_cats'] = array(
'#type' => 'checkbox',
'#title' => t("Show sub-categories on FAQ category pages"),
'#description' => t("Sub-categories with 'faq' nodes will be displayed on the per category FAQ page. This will also happen if 'Only show sub-categories when parent category is selected' is set."),
'#default_value' => variable_get('faq_show_cat_sub_cats', FALSE),
);
return system_settings_form($form);
}