You are here

function context_ui_menu in Context 5

Same name and namespace in other branches
  1. 6.3 context_ui/context_ui.module \context_ui_menu()
  2. 6 context_ui/context_ui.module \context_ui_menu()
  3. 6.2 context_ui/context_ui.module \context_ui_menu()
  4. 7.3 context_ui/context_ui.module \context_ui_menu()

Implementation of hook_menu().

File

context_ui/context_ui.module, line 138

Code

function context_ui_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/build/context',
      'callback' => 'context_ui_admin',
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
      'title' => t('Context'),
      'description' => t('Associate menus, views, blocks, etc. with different contexts to structure your site.'),
    );
    $items[] = array(
      'path' => 'admin/build/context/list',
      'title' => t('List'),
      'callback' => 'context_ui_admin',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 0,
    );
    $items[] = array(
      'path' => 'admin/build/context/add',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'context_ui_form',
        'add',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_LOCAL_TASK,
      'title' => t('Add Context'),
      'description' => t('Add a context to your site.'),
      'weight' => 1,
    );
    $items[] = array(
      'title' => t('Import'),
      'path' => 'admin/build/context/import',
      'callback' => 'context_ui_import_page',
      'access' => user_access('administer site configuration'),
      'type' => MENU_LOCAL_TASK,
      'description' => t('Import a context definition into your site.'),
      'weight' => 2,
    );
    $items[] = array(
      'path' => 'admin/build/context/edit',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'context_ui_form',
        'edit',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/context/clone',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'context_ui_form',
        'clone',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
      'title' => t('Clone Context'),
      'description' => t('Duplicate an existing context.'),
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'admin/build/context/view',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'context_ui_form',
        'view',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/context/export',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'context_ui_export',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/context/delete',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'context_ui_delete_confirm',
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    return $items;
  }
  else {

    // Include admin functions
    if (arg(0) . '/' . arg(1) . '/' . arg(2) == 'admin/build/context') {
      include_once drupal_get_path("module", "context_ui") . "/context_ui_admin.inc";
    }
    else {
      if ($_GET['q'] == 'admin/build/modules') {
        include_once drupal_get_path("module", "context_ui") . "/context_ui_admin.inc";
        context_ui_rebuild();
      }
    }
  }
}