You are here

function faq_menu in Frequently Asked Questions 5

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

Implementation of hook_menu()

File

./faq.module, line 63

Code

function faq_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/faq',
      'title' => t('Frequently Asked Questions Settings'),
      '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' => 'faq',
      'title' => variable_get('faq_title', t('Frequently Asked Questions')),
      'callback' => 'faq_page',
      'access' => user_access('view faq'),
      'weight' => 1,
    );
    $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'),
    );
    $items[] = array(
      'path' => 'faq',
      'title' => variable_get('faq_title', t('Frequently Asked Questions')),
      'callback' => 'faq_page',
      'access' => user_access('view faq'),
      'weight' => 1,
    );
    if (arg(0) == 'faq' && is_numeric(arg(1))) {
      $items[] = array(
        'path' => 'faq/' . arg(1),
        'title' => variable_get('faq_title', t('Frequently Asked Questions')),
        'callback' => 'faq_page',
        'callback arguments' => array(
          arg(1),
        ),
        'access' => user_access('view faq'),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}