You are here

function hosting_menu in Hosting 5

Same name and namespace in other branches
  1. 6.2 hosting.module \hosting_menu()
  2. 7.4 hosting.module \hosting_menu()
  3. 7.3 hosting.module \hosting_menu()

Implementation of hook_menu()

File

./hosting.module, line 21
Hosting module

Code

function hosting_menu($may_cache = true) {
  global $user;
  $items = array();
  hosting_wizard_menu($may_cache, $items);
  if ($may_cache) {
    $items[] = array(
      'path' => 'hosting/disabled',
      'title' => t('Site disabled'),
      'callback' => 'hosting_disabled_site',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'hosting/maintenance',
      'title' => t('Site maintenance'),
      'callback' => 'hosting_site_maintenance',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/help/provision/requirements',
      'title' => t('Provisioning requirements'),
      'description' => t("Information of how to configure the provisioning system."),
      'callback' => 'hosting_help_requirements',
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/hosting',
      'title' => t('Hosting'),
      'description' => t('Configure and manage the hosting system'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'hosting_features_form',
      ),
      'access' => user_access('administer hosting'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/hosting/features',
      'title' => t('Features'),
      'description' => t('Configure the exposed functionality of the Hosting system'),
      'weight' => -100,
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'hosting_features_form',
      ),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'access' => user_access('administer hosting features'),
    );
    $items[] = array(
      'path' => 'admin/hosting/queues',
      'title' => t('Queues'),
      'description' => t('Configure the frequency that cron, backup and task events are process'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'hosting_queues_configure',
      ),
      'type' => MENU_LOCAL_TASK,
      'access' => user_access('administer hosting queues'),
    );

    // Kludge : Replace node/add page to hide functionality.
    $items[] = array(
      'path' => 'node/add',
      'title' => t('Create content'),
      'callback' => '_hosting_node_add',
      'access' => user_access('access content'),
      'type' => MENU_ITEM_GROUPING,
      'weight' => 1,
    );

    // Queue page & task lists
    $items[] = array(
      'path' => 'hosting/queues',
      'callback' => 'hosting_queues',
      'type' => MENU_CALLBACK,
      'access' => user_access('access task logs'),
    );

    // Disable unsupported features.
    $features = hosting_get_features();
    $types = node_get_types();
    foreach ($features as $type => $feature) {
      if (isset($feature['node'])) {
        $type_url_str = str_replace('_', '-', $feature['node']);
        $items[] = array(
          'path' => 'node/add/' . $type_url_str,
          'title' => drupal_ucfirst($types[$feature['node']]->name),
          'access' => ($user->uid == 1 || user_access('create ' . $feature['node'])) && hosting_feature($type) != HOSTING_FEATURE_DISABLED,
        );
      }
    }
  }
  else {
    drupal_add_css(drupal_get_path('module', 'hosting') . '/hosting.css');
  }
  return $items;
}