function faq_menu in Frequently Asked Questions 5.2
Same name and namespace in other branches
- 5 faq.module \faq_menu()
- 6 faq.module \faq_menu()
- 7.2 faq.module \faq_menu()
- 7 faq.module \faq_menu()
Implementation of hook_menu().
File
- ./
faq.module, line 66 - The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.
Code
function faq_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'faq',
'title' => variable_get('faq_title', 'Frequently Asked Questions'),
'callback' => 'faq_page',
'access' => user_access('view faq page'),
'weight' => 1,
);
if (arg(0) == 'faq' && is_numeric(arg(1))) {
$items[] = array(
'path' => 'faq/' . arg(1),
'title' => variable_get('faq_title', 'Frequently Asked Questions'),
'callback' => 'faq_page',
'callback arguments' => array(
arg(1),
),
'access' => user_access('view faq page'),
'type' => MENU_CALLBACK,
);
}
$items[] = array(
'path' => 'admin/settings/faq',
'title' => t('Frequently Asked Questions'),
'callback' => 'faq_settings_page',
'access' => user_access('administer faq'),
'description' => t('Allows the user to configure the layout of questions and answers on a FAQ page.'),
);
$items[] = array(
'path' => 'admin/settings/faq/general',
'title' => t('General'),
'description' => t('Allows the user to configure the header and descriptive text for the FAQ page.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'faq_general_settings_form',
),
'access' => user_access('administer faq'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/settings/faq/questions',
'title' => t('Questions'),
'description' => t('Allows the user to configure the layout of questions and answers on a FAQ page.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'faq_questions_settings_form',
),
'access' => user_access('administer faq'),
'type' => MENU_LOCAL_TASK,
'weight' => -9,
);
$items[] = array(
'path' => 'admin/settings/faq/categories',
'title' => t('Categories'),
'description' => t('Allows the user to configure the layout of questions and answers using categories on a FAQ page.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'faq_categories_settings_form',
),
'access' => user_access('administer faq'),
'type' => MENU_LOCAL_TASK,
'weight' => -8,
);
$items[] = array(
'path' => 'admin/settings/faq/weight',
'title' => t('Weight'),
'description' => t('Allows the user to configure the order of questions and answers on a FAQ page.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'faq_weight_settings_form',
),
'access' => user_access('administer faq'),
'type' => MENU_LOCAL_TASK,
'weight' => -8,
);
$items[] = array(
'path' => 'node/add/faq',
'title' => t('FAQ'),
'access' => user_access('create faq'),
);
}
return $items;
}