You are here

function hosting_wizard_steps in Hosting 5

Control structure for stepping through the installation wizard.

This couldn't be simpler. It generates a set of menu items for each of the steps, based on the key of the array.

Each step has it's own form, that is a configuration form.

Multiple levels are supported, as field/sub gets turned into a hosting_wizard_field_sub() form callback.

Simpler, and easier to maintain than writing actual _menu items, as this lowers our upgrade dependencies for D6, by only having 2 items that need to be reimplemented.

4 calls to hosting_wizard_steps()
hosting_wizard_form in ./hosting.wizard.inc
Form modifier similar to confirm_form
hosting_wizard_menu in ./hosting.wizard.inc
Wizard menu items.
hosting_wizard_next_step in ./hosting.wizard.inc
hosting_wizard_set_title in ./hosting.wizard.inc

File

./hosting.wizard.inc, line 18

Code

function hosting_wizard_steps($step = null) {
  static $steps = array();
  global $user;
  if (!sizeof($steps)) {
    $steps['intro'] = array(
      'title' => t("Introduction"),
      'heading' => t("Welcome to your new hosting system"),
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    if ($user->uid == 1) {
      $steps['account'] = array(
        'title' => t("User account"),
        'heading' => t("Configure your user account"),
        'message' => t('An administrator account has been registered for you. Please change your password to continue with the configuration process.'),
      );
    }
    $steps['provision'] = array(
      'title' => t("Provisioning"),
      'heading' => t("Configure your provisioning framework"),
      'message' => t('To be able to create sites using Hostmaster, we need some information about your server.'),
    );
    $steps['provision/web'] = array(
      'title' => t("Web server"),
      'heading' => t("Configure your web server"),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'message' => t("You will need somewhere to server your files from."),
    );
    $steps['provision/paths'] = array(
      'title' => t("Paths"),
      'heading' => t("Configure where to store provisioning data"),
      'message' => t('To be able to create sites using Hostmaster, provisioning needs access to the file system.'),
    );
    $steps['provision/db'] = array(
      'title' => t('Database server'),
      'heading' => t('Configure your database server'),
      'message' => t("You need to be able to create databases and database users."),
    );
    $steps['hosting'] = array(
      'title' => t('Hosting'),
      'heading' => t('Set up your hosting framework'),
      'message' => t("Finalize your setup by ensuring communication between the front end and back end."),
    );
    $steps['hosting/features'] = array(
      'title' => t('Features'),
      'heading' => t('Enable hosting features'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'message' => t("Enable or disable any of the features available."),
    );
    $steps['hosting/init'] = array(
      'title' => t('Initialize'),
      'heading' => t('Initialize the hosting system'),
      'message' => t("Finalize your setup by ensuring communication between the front end and back end."),
    );
    $steps['hosting/verify'] = array(
      'title' => t('Verify platform'),
      'heading' => t('Verify platform settings'),
      'message' => t("Verify that the provisioning system is correctly set up, and new sites can be hosted on it."),
    );
    $steps['hosting/import'] = array(
      'title' => t('Import sites'),
      'heading' => t('Import your existing sites'),
      'message' => t("Details of any existing sites found and imported into Hostmaster."),
    );
    $steps['complete'] = array(
      'title' => t("Complete"),
      'heading' => t('Complete your installation'),
      'message' => t("Congratulations, you have finished installation of hostmaster. If you have any questions, go to groups.drupal.org/hm2."),
    );
  }
  if ($step && $steps[$step]) {
    return $steps[$step];
  }
  return $steps;
}