You are here

function mobile_codes_menu in Mobile Codes 5

Same name and namespace in other branches
  1. 6.2 includes/system.inc \mobile_codes_menu()
  2. 6 mobile_codes.module \mobile_codes_menu()
  3. 7.2 includes/system.inc \mobile_codes_menu()

Implementation of hook_menu().

File

./mobile_codes.module, line 20
Mobile Codes core functions

Code

function mobile_codes_menu($may_cache) {
  $items = array();
  if (!$may_cache) {

    // Only include administrative callbacks if we are viewing an admin page.
    if (arg(0) == 'admin') {
      include_once drupal_get_path('module', 'mobile_codes') . '/mobile_codes.admin.inc';
    }
  }
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/mobile_codes',
      'title' => 'Mobile Codes',
      'callback' => 'mobile_codes_overview',
      'access' => user_access('administer mobile codes'),
      'file' => 'mobile_codes.admin.inc',
    );
    $items[] = array(
      'path' => 'admin/settings/mobile_codes/presets',
      'title' => 'Presets',
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/mobile_codes/presets/list',
      'title' => 'List',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/settings/mobile_codes/presets/add',
      'title' => 'Add preset',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'mobile_codes_presets_form',
      ),
      'access' => user_access('administer mobile codes'),
      'file' => 'mobile_codes.admin.inc',
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/mobile_codes/settings',
      'title' => 'Settings',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'mobile_codes_settings_form',
      ),
      'access' => user_access('administer mobile codes'),
      'file' => 'mobile_codes.admin.inc',
      'type' => MENU_LOCAL_TASK,
    );
  }
  else {
    $items[] = array(
      'path' => 'admin/settings/mobile_codes/presets/' . arg(4) . '/delete',
      'title' => 'Delete preset',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'mobile_codes_presets_delete',
        arg(4),
      ),
      'access' => user_access('administer mobile codes'),
      'file' => 'mobile_codes.admin.inc',
    );
    $items[] = array(
      'path' => 'admin/settings/mobile_codes/presets/' . arg(4) . '/edit',
      'title' => 'Edit preset',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'mobile_codes_presets_form_edit',
        arg(4),
      ),
      'access' => user_access('administer mobile codes'),
      'file' => 'mobile_codes.admin.inc',
    );
  }
  return $items;
}