You are here

function hosting_wizard_menu in Hosting 5

Wizard menu items.

Branches off from hosting using the referenced &$items parameter. I'm not entirely sure the wizard is big enough to need it's own module yet.

1 call to hosting_wizard_menu()
hosting_menu in ./hosting.module
Implementation of hook_menu()

File

./hosting.wizard.inc, line 77

Code

function hosting_wizard_menu($may_cache, &$items) {
  $items[] = array(
    'path' => 'hosting/wizard',
    'title' => t('Hosting wizard'),
    'description' => t('Configuration wizard'),
    'callback' => 'drupal_get_form',
    'callback arguments' => array(
      'hosting_wizard_intro',
    ),
    'type' => MENU_NORMAL_ITEM,
    'access' => user_access('access hosting wizard'),
  );
  if (!$may_cache && sprintf("%s/%s", arg(0), arg(1)) == 'hosting/wizard') {
    hosting_wizard_dummy_theme_block();
    $steps = hosting_wizard_steps();
    $x = 1;
    foreach ($steps as $key => $step) {
      $form_id = array(
        'hosting_wizard_' . str_replace("/", "_", $key),
      );
      $wizard_items[$key] = array(
        'path' => 'hosting/wizard/' . $key,
        'title' => $step['title'],
        'description' => $step['message'],
        'callback' => 'drupal_get_form',
        'callback arguments' => $form_id,
        'type' => $step['type'] ? $step['type'] : MENU_LOCAL_TASK,
        'access' => user_access('access hosting wizard'),
        'weight' => $x++,
      );
      if ($step['type'] == MENU_DEFAULT_LOCAL_TASK) {
        $parts = explode("/", $key);
        if (sizeof($parts) >= 2) {
          $parent = array_shift($parts);
          $wizard_items[$parent]['callback arguments'] = $form_id;
        }
      }
    }
    $items = array_merge($items, $wizard_items);
  }
}