function faq_questions_settings_form in Frequently Asked Questions 7.2
Same name and namespace in other branches
- 5.2 faq.module \faq_questions_settings_form()
- 5 faq.module \faq_questions_settings_form()
- 6 faq.admin.inc \faq_questions_settings_form()
- 7 faq.admin.inc \faq_questions_settings_form()
Define the elements for the FAQ Settings page - Questions tab.
Return value
The form code inside the $form array.
1 string reference to 'faq_questions_settings_form'
- faq_menu in ./
faq.module - Implements hook_menu().
File
- ./
faq.admin.inc, line 64 - Administrative page callbacks for the faq module.
Code
function faq_questions_settings_form($form, &$form_state) {
$form['faq_category_display'] = array(
'#type' => 'hidden',
'#value' => variable_get('faq_category_display', 'categories_inline'),
);
$form['faq_use_categories'] = array(
'#type' => 'hidden',
'#value' => variable_get('faq_use_categories', FALSE),
);
$display_options['questions_inline'] = t('Questions inline');
$display_options['questions_top'] = t('Clicking on question takes user to answer further down the page');
$display_options['hide_answer'] = t('Clicking on question opens/hides answer under question');
$display_options['new_page'] = t('Clicking on question opens the answer in a new page');
$form['faq_display'] = array(
'#type' => 'radios',
'#options' => $display_options,
'#title' => t('Page layout'),
'#description' => t('This controls how the questions and answers are displayed on the page and what happens when someone clicks on the question.'),
'#default_value' => variable_get('faq_display', 'questions_top'),
);
$form['faq_questions_misc'] = array(
'#type' => 'fieldset',
'#title' => t('Miscellaneous layout settings'),
'#collapsible' => TRUE,
);
$form['faq_questions_misc']['faq_question_listing'] = array(
'#type' => 'select',
'#options' => array(
'ol' => t('Ordered list'),
'ul' => t('Unordered list'),
),
'#title' => t('Questions listing style'),
'#default_value' => variable_get('faq_question_listing', 'ul'),
'#states' => array(
'visible' => array(
':input[name="faq_display"], dummy-0' => array(
'!value' => 'hide_answer',
),
':input[name="faq_display"], dummy-1' => array(
'!value' => 'questions_inline',
),
),
),
);
$form['faq_questions_misc']['faq_qa_mark'] = array(
'#type' => 'checkbox',
'#title' => t('Label questions and answers'),
'#description' => t('It labels all questions on the faq page with the "question label" setting and all answers with the "answer label" setting. For example these could be set to "Q:" and "A:".'),
'#default_value' => variable_get('faq_qa_mark', FALSE),
'#states' => array(
'visible' => array(
':input[name="faq_display"], dummy-0' => array(
'!value' => 'hide_answer',
),
':input[name="faq_display"], dummy-1' => array(
'!value' => 'new_page',
),
),
),
);
$form['faq_questions_misc']['faq_question_label'] = array(
'#type' => 'textfield',
'#title' => t('Question Label'),
'#default_value' => variable_get('faq_question_label', 'Q:'),
'#states' => array(
'visible' => array(
':input[name="faq_display"], dummy-0' => array(
'!value' => 'hide_answer',
),
':input[name="faq_display"], dummy-1' => array(
'!value' => 'new_page',
),
':input[name="faq_qa_mark"]' => array(
'checked' => TRUE,
),
),
),
);
$form['faq_questions_misc']['faq_answer_label'] = array(
'#type' => 'textfield',
'#title' => t('Answer Label'),
'#default_value' => variable_get('faq_answer_label', 'A:'),
'#states' => array(
'visible' => array(
':input[name="faq_display"], dummy-0' => array(
'!value' => 'hide_answer',
),
':input[name="faq_display"], dummy-1' => array(
'!value' => 'new_page',
),
':input[name="faq_qa_mark"]' => array(
'checked' => TRUE,
),
),
),
);
$form['faq_questions_misc']['faq_question_long_form'] = array(
'#type' => 'checkbox',
'#title' => t('Allow long question text to be configured'),
'#default_value' => variable_get('faq_question_long_form', 1),
);
$form['faq_questions_misc']['faq_question_length'] = array(
'#type' => 'radios',
'#title' => t('Question length'),
'#options' => array(
'long' => t('Display longer text'),
'short' => t('Display short text'),
'both' => t('Display both short and long questions'),
),
'#description' => t('The length of question text to display on the FAQ page. The short question will always be displayed in the FAQ blocks.'),
'#default_value' => variable_get('faq_question_length', 'short'),
'#states' => array(
'visible' => array(
':input[name="faq_question_long_form"]' => array(
'checked' => TRUE,
),
),
),
);
$form['faq_questions_misc']['faq_hide_qa_accordion'] = array(
'#type' => 'checkbox',
'#title' => t('Use accordion effect'),
'#description' => t('This enables an "accordion" style effect where when a question is clicked, the answer appears beneath, and is then hidden when another question is opened.'),
'#default_value' => variable_get('faq_hide_qa_accordion', FALSE),
'#states' => array(
'visible' => array(
':input[name="faq_display"]' => array(
'value' => 'hide_answer',
),
),
),
);
$form['faq_questions_misc']['faq_show_expand_all'] = array(
'#type' => 'checkbox',
'#title' => t('Show "expand / collapse all" links for collapsed questions'),
'#default_value' => variable_get('faq_show_expand_all', FALSE),
'#states' => array(
'invisible' => array(
':input[name="faq_display"]' => array(
'!value' => 'hide_answer',
),
':input[name="faq_use_categories"]' => array(
'checked' => FALSE,
),
':input[name="faq_category_display"]' => array(
'!value' => 'hide_qa',
),
),
),
);
$form['faq_questions_misc']['faq_use_teaser'] = array(
'#type' => 'checkbox',
'#title' => t('Use answer teaser'),
'#default_value' => variable_get('faq_use_teaser', FALSE),
'#states' => array(
'invisible' => array(
':input[name="faq_display"]' => array(
'value' => 'new_page',
),
),
),
);
$form['faq_questions_misc']['faq_show_node_links'] = array(
'#type' => 'checkbox',
'#title' => t('Show node links'),
'#description' => t('This enables the display of links under the answer text on the faq page. Examples of these links include "Read more", "Add comment".'),
'#default_value' => variable_get('faq_show_node_links', FALSE),
'#states' => array(
'invisible' => array(
':input[name="faq_display"]' => array(
'value' => 'new_page',
),
),
),
);
$form['faq_questions_misc']['faq_back_to_top'] = array(
'#type' => 'textfield',
'#title' => t('"Back to Top" link text'),
'#description' => t('This allows the user to change the text displayed for the links which return the user to the top of the page. Defaults to "Back to Top". Leave blank to have no link.'),
'#default_value' => variable_get('faq_back_to_top', 'Back to Top'),
'#states' => array(
'invisible' => array(
':input[name="faq_display"]' => array(
'value' => 'new_page',
),
),
),
);
$form['faq_questions_misc']['faq_disable_node_links'] = array(
'#type' => 'checkbox',
'#title' => t('Disable question links to nodes'),
'#description' => t('This allows the user to prevent the questions being links to the faq node.'),
'#default_value' => variable_get('faq_disable_node_links', FALSE),
'#states' => array(
'invisible' => array(
':input[name="faq_display"]' => array(
'value' => 'new_page',
),
),
),
);
$form['faq_questions_misc']['faq_default_sorting'] = array(
'#type' => 'select',
'#title' => t('Default sorting for unordered FAQs'),
'#options' => array(
'DESC' => t('Date Descending'),
'ASC' => t('Date Ascending'),
),
'#description' => t("This controls the default ordering behaviour for new FAQ nodes which haven't been assigned a position."),
'#default_value' => variable_get('faq_default_sorting', 'DESC'),
);
return system_settings_form($form);
}