You are here

function demo_menu in Demonstration site (Sandbox / Snapshot) 5

Same name and namespace in other branches
  1. 6 demo.module \demo_menu()
  2. 7 demo.module \demo_menu()

Implementation of hook_menu().

File

./demo.module, line 18
Demonstration Site module

Code

function demo_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $admin_access = user_access('administer demo settings');
    $items[] = array(
      'path' => 'admin/build/demo',
      'title' => t('Demonstration site'),
      'description' => t('Administer reset interval, create new dumps and manually reset this site.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'demo_admin_settings',
      ),
      'access' => $admin_access,
    );
    $items[] = array(
      'path' => 'admin/build/demo/maintenance',
      'title' => t('Status'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 0,
    );
    $items[] = array(
      'path' => 'admin/build/demo/manage',
      'title' => t('Manage snapshots'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'demo_manage',
      ),
      'access' => $admin_access,
      'type' => MENU_LOCAL_TASK,
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'admin/build/demo/dump',
      'title' => t('Create snapshot'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'demo_dump',
      ),
      'access' => $admin_access,
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
    );
    $items[] = array(
      'path' => 'admin/build/demo/reset',
      'title' => t('Reset site'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'demo_reset_confirm',
      ),
      'access' => $admin_access,
      'type' => MENU_LOCAL_TASK,
      'weight' => 3,
    );
    $items[] = array(
      'path' => 'admin/build/demo/delete',
      'title' => t('Delete snapshot'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'demo_delete_confirm',
      ),
      'access' => $admin_access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'demo/autocomplete',
      'callback' => 'demo_autocomplete',
      'access' => $admin_access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'demo/download',
      'callback' => 'demo_download',
      'access' => $admin_access,
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if (strpos($_GET['q'], 'admin/build/demo') === 0 || strpos($_GET['q'], 'demo') === 0) {
      require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
    }
  }
  return $items;
}