You are here

function uc_product_menu in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_menu()
  2. 7.3 uc_product/uc_product.module \uc_product_menu()

Implements hook_menu().

File

uc_product/uc_product.module, line 18
The product module for Ubercart.

Code

function uc_product_menu() {
  $items = array();
  $items['admin/store/products'] = array(
    'title' => 'Products',
    'description' => 'Administer products, classes, and more.',
    'access arguments' => array(
      'administer products',
    ),
    'page callback' => 'uc_product_administration',
    'type' => MENU_NORMAL_ITEM,
    'weight' => -2,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/products/view'] = array(
    'title' => 'View products',
    'description' => 'Build and view a list of product nodes.',
    'access arguments' => array(
      'administer products',
    ),
    'type' => MENU_NORMAL_ITEM,
    'weight' => -10,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/products/classes'] = array(
    'title' => 'Manage classes',
    'description' => 'Create and edit product node types.',
    'access arguments' => array(
      'administer product classes',
    ),
    'page callback' => 'uc_product_class_default',
    'type' => MENU_NORMAL_ITEM,
    'weight' => -2,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/settings/products'] = array(
    'title' => 'Product settings',
    'description' => 'Configure product settings.',
    'access arguments' => array(
      'administer products',
    ),
    'page callback' => 'uc_product_settings_overview',
    'type' => MENU_NORMAL_ITEM,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/settings/products/overview'] = array(
    'title' => 'Overview',
    'weight' => -10,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/store/settings/products/edit'] = array(
    'title' => 'Edit',
    'access arguments' => array(
      'administer products',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'uc_product_settings_form',
    ),
    'weight' => -5,
    'type' => MENU_LOCAL_TASK,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/settings/products/edit/general'] = array(
    'title' => 'Product settings',
    'access arguments' => array(
      'administer products',
    ),
    'weight' => -10,
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/settings/products/edit/fields'] = array(
    'title' => 'Product fields',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'uc_product_field_settings_form',
    ),
    'access arguments' => array(
      'administer products',
    ),
    'weight' => -5,
    'type' => MENU_LOCAL_TASK,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/settings/products/edit/features'] = array(
    'title' => 'Product features',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'uc_product_feature_settings_form',
    ),
    'access arguments' => array(
      'administer product features',
    ),
    'weight' => 0,
    'type' => MENU_LOCAL_TASK,
    'file' => 'uc_product.admin.inc',
  );

  // Insert subitems into the edit node page for product types.
  $items['node/%node/edit/product'] = array(
    'title' => 'Product',
    'access callback' => 'uc_product_edit_access',
    'access arguments' => array(
      1,
    ),
    'weight' => -10,
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file' => 'uc_product.admin.inc',
  );
  $features = module_invoke_all('product_feature');
  if (!empty($features)) {
    $items['node/%node/edit/features'] = array(
      'title' => 'Features',
      'page callback' => 'uc_product_features',
      'page arguments' => array(
        1,
      ),
      'access callback' => 'uc_product_feature_access',
      'access arguments' => array(
        1,
      ),
      'weight' => 10,
      'type' => MENU_LOCAL_TASK,
      'file' => 'uc_product.admin.inc',
    );
  }
  $items['admin/store/settings/products/defaults'] = array(
    'access arguments' => array(
      'administer products',
    ),
    'page callback' => 'uc_product_image_defaults',
    'type' => MENU_CALLBACK,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/products/classes/%uc_product_class'] = array(
    'title' => 'Product class',
    'access arguments' => array(
      'administer product classes',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'uc_product_class_form',
      4,
    ),
    'type' => MENU_CALLBACK,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/products/classes/%uc_product_class/edit'] = array(
    'title' => 'Edit',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -5,
    'file' => 'uc_product.admin.inc',
  );
  $items['admin/store/products/classes/%uc_product_class/delete'] = array(
    'access callback' => 'uc_product_class_delete_access',
    'access arguments' => array(
      4,
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'uc_product_class_delete_confirm',
      4,
    ),
    'type' => MENU_CALLBACK,
    'file' => 'uc_product.admin.inc',
  );

  // Define an autocomplete path for products using the title or SKU.
  $items['autocomplete/uc_product_title_sku'] = array(
    'page callback' => 'uc_product_title_sku_autocomplete',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'uc_product.pages.inc',
  );
  return $items;
}