You are here

function commerce_checkout_menu in Commerce Core 7

Implements hook_menu().

File

modules/checkout/commerce_checkout.module, line 13
Enable checkout as a multi-step form with customizable pages and a simple checkout pane API.

Code

function commerce_checkout_menu() {
  $items = array();
  $items['checkout/%commerce_order'] = array(
    'title' => 'Checkout',
    'page callback' => 'commerce_checkout_router',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'access checkout',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/commerce_checkout.pages.inc',
  );
  $items['checkout/%commerce_order/%commerce_checkout_page'] = array(
    'title' => 'Checkout',
    'page callback' => 'commerce_checkout_router',
    'page arguments' => array(
      1,
      2,
    ),
    'access arguments' => array(
      'access checkout',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/commerce_checkout.pages.inc',
  );
  $items['admin/commerce/config/checkout'] = array(
    'title' => 'Checkout settings',
    'description' => 'Customize the checkout form and configure checkout rules.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_checkout_builder_form',
    ),
    'access arguments' => array(
      'administer checkout',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'includes/commerce_checkout.admin.inc',
  );
  $items['admin/commerce/config/checkout/form'] = array(
    'title' => 'Checkout form',
    'description' => 'Build your checkout pages using module defined checkout form elements.',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
    'file' => 'includes/commerce_checkout.admin.inc',
  );
  $items['admin/commerce/config/checkout/rules'] = array(
    'title' => 'Checkout rules',
    'description' => 'Enable and configure checkout completion rules.',
    'page callback' => 'commerce_checkout_complete_rules',
    'access arguments' => array(
      'administer checkout',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 5,
    'file' => 'includes/commerce_checkout.admin.inc',
  );

  // Add the menu items for the various Rules forms.
  $controller = new RulesUIController();
  $items += $controller
    ->config_menu('admin/commerce/config/checkout/rules');
  $items['admin/commerce/config/checkout/rules/add'] = array(
    'title' => 'Add a checkout rule',
    'description' => 'Adds an additional checkout completion rule configuration.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_checkout_add_complete_rule_form',
      'admin/commerce/config/checkout/rules',
    ),
    'access arguments' => array(
      'administer checkout',
    ),
    'file path' => drupal_get_path('module', 'rules_admin'),
    'file' => 'rules_admin.inc',
    'type' => MENU_LOCAL_ACTION,
  );
  $items['admin/commerce/config/checkout/form/pane/%commerce_checkout_pane'] = array(
    'title callback' => 'commerce_checkout_pane_settings_title',
    'title arguments' => array(
      6,
    ),
    'description' => 'Configure the settings for a checkout pane.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_checkout_pane_settings_form',
      6,
    ),
    'access arguments' => array(
      'administer checkout',
    ),
    'file' => 'includes/commerce_checkout.admin.inc',
  );

  // If the Order UI module is installed, add a local action to it that lets an
  // administrator invoke the checkout completion event on the order. Modules
  // that define their own order edit menu item are also responsible for
  // defining their own local action menu items if needed.
  if (module_exists('commerce_order_ui')) {
    $items['admin/commerce/orders/%commerce_order/edit/checkout'] = array(
      'title' => 'Simulate checkout completion',
      'description' => 'Directly invokes the checkout completion rules on the order.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'commerce_checkout_complete_form',
        3,
      ),
      'access callback' => 'commerce_checkout_complete_form_access',
      'access arguments' => array(
        3,
      ),
      'type' => MENU_LOCAL_ACTION,
      'file' => 'includes/commerce_checkout.admin.inc',
    );
  }
  return $items;
}