You are here

function lexicon_menu in Lexicon 7

Same name and namespace in other branches
  1. 6 lexicon.module \lexicon_menu()

Implements hook_menu().

File

./lexicon.module, line 315
The Lexicon module is used to create lists of terms and definitions to use on a website and optionally mark those terms in the content of the website.

Code

function lexicon_menu() {

  // Get all the id's of vocabularies that are configured in the settings.
  $vids = variable_get('lexicon_vids', array());

  // Get rid off any array items with value '0'.
  $vids = array_filter($vids);

  // Create a menu item for each vocabulary with the configured path and title.
  foreach ($vids as $vid) {

    // Don't create menu items for vocabularies that are not Lexicon
    // vocabularies.
    $lexicon_page_enabled = variable_get('lexicon_page_enabled_' . $vid, TRUE);
    if ($lexicon_page_enabled) {
      $lexicon_path = variable_get('lexicon_path_' . $vid, 'lexicon/' . $vid);
      $lexicon_title = variable_get('lexicon_title_' . $vid, t('Lexicon'));
      $items[$lexicon_path] = array(
        'title' => $lexicon_title,
        'page callback' => '_lexicon_page',
        'access arguments' => array(
          'access lexicon',
        ),
        'file' => 'lexicon.pages.inc',
        'file path' => drupal_get_path('module', 'lexicon') . '/includes',
      );
    }
  }
  $items['admin/config/system/lexicon'] = array(
    'title' => 'Lexicon Settings',
    'page callback' => 'lexicon_settings_page',
    'description' => 'Configure the Lexicon module settings.',
    'access arguments' => array(
      'administer lexicon',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'lexicon.admin.inc',
    'file path' => drupal_get_path('module', 'lexicon') . '/includes',
  );
  $items['admin/config/system/lexicon/general'] = array(
    'title' => 'General',
    'description' => 'General settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'lexicon_general_settings_form',
    ),
    'access arguments' => array(
      'administer lexicon',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -5,
    'file' => 'lexicon.admin.inc',
    'file path' => drupal_get_path('module', 'lexicon') . '/includes',
  );
  $items['admin/config/system/lexicon/pages-settings'] = array(
    'title' => 'Pages settings',
    'description' => 'Pages settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'lexicon_pages_settings_form',
    ),
    'access arguments' => array(
      'administer lexicon',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 0,
    'file' => 'lexicon.admin.inc',
    'file path' => drupal_get_path('module', 'lexicon') . '/includes',
  );
  $items['admin/config/system/lexicon/additional-fields'] = array(
    'title' => 'Additional fields settings',
    'description' => 'Additional fields settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'lexicon_additional_fields_settings_form',
    ),
    'access arguments' => array(
      'administer lexicon',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 5,
    'file' => 'lexicon.admin.inc',
    'file path' => drupal_get_path('module', 'lexicon') . '/includes',
  );
  $items['admin/config/system/lexicon/alphabar'] = array(
    'title' => 'Alphabar settings',
    'description' => 'Alphabar settings.',
    'access arguments' => array(
      'administer lexicon',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'lexicon_alphabet_form',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
    'file' => 'lexicon.admin.inc',
    'file path' => drupal_get_path('module', 'lexicon') . '/includes',
  );
  return $items;
}