You are here

function faq_questions_settings_form in Frequently Asked Questions 5

Same name and namespace in other branches
  1. 5.2 faq.module \faq_questions_settings_form()
  2. 6 faq.admin.inc \faq_questions_settings_form()
  3. 7.2 faq.admin.inc \faq_questions_settings_form()
  4. 7 faq.admin.inc \faq_questions_settings_form()

Define a form to edit the questions/answers setup

1 string reference to 'faq_questions_settings_form'
faq_menu in ./faq.module
Implementation of hook_menu()

File

./faq.module, line 280

Code

function faq_questions_settings_form() {
  drupal_add_js(drupal_get_path('module', 'faq') . '/faq.js', 'module');
  $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' => 'Ordered list',
      'ul' => 'Unordered list',
    ),
    '#title' => t('Questions listing style'),
    '#description' => t("This allows to select how the questions listing is presented.  It only applies to the layouts: 'Clicking on question takes user to answer further down the page' and 'Clicking on question opens the answer in a new page'.  An ordered listing would number the questions, whereas an unordered list will have a bullet to the left of each question."),
    '#default_value' => variable_get('faq_question_listing', 'ul'),
  );
  $form['faq_questions_misc']['faq_qa_mark'] = array(
    '#type' => 'checkbox',
    '#title' => t('Label questions and answers'),
    '#description' => t('This option is only valid for the "Questions Inline" layout.  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),
  );
  $form['faq_questions_misc']['faq_question_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Question Label'),
    '#description' => t('The label to pre-pend to the question text in the "Questions Inline" layout if labelling is enabled.'),
    '#default_value' => variable_get('faq_question_label', 'Q:'),
  );
  $form['faq_questions_misc']['faq_answer_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Answer Label'),
    '#description' => t('The label to pre-pend to the answer text in the "Questions Inline" layout if labelling is enabled.'),
    '#default_value' => variable_get('faq_answer_label', 'A:'),
  );
  $form['faq_questions_misc']['faq_use_teaser'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use answer teaser'),
    '#description' => t("This enables the display of the answer teaser text instead of the full answer when using the 'Questions inline' or 'Clicking on question takes user to answer further down the page' display options.  This is useful when you have long descriptive text.  The user can see the full answer by clicking on the question."),
    '#default_value' => variable_get('faq_use_teaser', FALSE),
  );
  $form['faq_questions_misc']['faq_more_link'] = array(
    '#type' => 'textfield',
    '#title' => t('">> more" link text'),
    '#description' => t('This allows the user to change the text displayed for the links to the full answer text when teasers are used.  Leave blank to have no link.'),
    '#default_value' => variable_get('faq_more_link', '>> more'),
  );
  $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 on certain page layouts.  Defaults to "Back to Top".  Leave blank to have no link.'),
    '#default_value' => variable_get('faq_back_to_top', 'Back to Top'),
  );
  return system_settings_form($form);
}