You are here

function commerce_stock_ui_menu in Commerce Stock 7.2

Implements hook_menu().

File

./commerce_stock_ui.module, line 11
Commerce stock UI.

Code

function commerce_stock_ui_menu() {
  $items = array();

  // The stock events page.
  $items['admin/commerce/config/stock/validation'] = array(
    'title' => 'Stock validation',
    'description' => 'Manage and configure stock validation events.',
    'page callback' => 'commerce_stock_admin_event_rules',
    'access arguments' => array(
      'administer rules',
    ),
    'weight' => 5,
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/commerce_stock.admin.inc',
  );

  // Add the menu items for the various Rules forms.
  $controller = new RulesUIController();
  $items += $controller
    ->config_menu('admin/commerce/config/stock/validation');

  // Add rule validation events.
  $items['admin/commerce/config/stock/validation/add_cart_state'] = array(
    'title' => 'Add a Cart state rule',
    'description' => 'Disable or modify the add to cart form.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_stock_ui_add_cart_state_rule_form',
      'admin/commerce/config/stock/validation',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file path' => drupal_get_path('module', 'rules_admin'),
    'file' => 'rules_admin.inc',
  );
  $items['admin/commerce/config/stock/validation/add_cart_action'] = array(
    'title' => 'Add a Cart action rule',
    'description' => 'Act on the add to cart action.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_stock_ui_add_cart_action_rule_form',
      'admin/commerce/config/stock/validation',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file path' => drupal_get_path('module', 'rules_admin'),
    'file' => 'rules_admin.inc',
  );
  $items['admin/commerce/config/stock/validation/add_checkout'] = array(
    'title' => 'Add a Validate cart / checkout rule',
    'description' => 'Validate products in the the cart before checkout.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_stock_ui_add_checkout_rule_form',
      'admin/commerce/config/stock/validation',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file path' => drupal_get_path('module', 'rules_admin'),
    'file' => 'rules_admin.inc',
  );

  // The stock control rules page.
  $items['admin/commerce/config/stock/control'] = array(
    'title' => 'Stock control',
    'description' => 'Manage and configure stock control rules.',
    'page callback' => 'commerce_stock_admin_stock_control_rules',
    'access arguments' => array(
      'administer rules',
    ),
    'weight' => 6,
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/commerce_stock.admin.inc',
  );

  // Add the menu items for the various Rules forms.
  $controller = new RulesUIController();
  $items += $controller
    ->config_menu('admin/commerce/config/stock/control');

  // Add stock control rule.
  $items['admin/commerce/config/stock/control/add'] = array(
    'title' => 'Create a stock control rule',
    'description' => 'Add a new stock control rule',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_stock_ui_stock_control_rule_form',
      'admin/commerce/config/stock/control',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file path' => drupal_get_path('module', 'rules_admin'),
    'file' => 'rules_admin.inc',
  );
  return $items;
}