You are here

function commerce_bpc_menu in Commerce Bulk Product Creation 7

Same name and namespace in other branches
  1. 7.2 commerce_bpc.module \commerce_bpc_menu()

Implements hook_menu().

File

./commerce_bpc.module, line 32

Code

function commerce_bpc_menu() {

  // Add a product.
  $items['admin/commerce/products/add-bulk'] = array(
    'title' => 'Bulk add products',
    'description' => 'Add a new group of products for sale in bulk.',
    'page callback' => 'commerce_bpc_add_page',
    'access callback' => 'commerce_bpc_product_add_any_access',
    'file' => 'commerce_bpc.pages.inc',
  );
  foreach (commerce_product_types() as $type => $product_type) {
    if (commerce_bpc_valid_product_type($type)) {
      $items['admin/commerce/products/add-bulk/' . $type] = array(
        'title' => 'Bulk add @name',
        'title arguments' => array(
          '@name' => $product_type['name'],
        ),
        'description' => $product_type['description'],
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'commerce_bpc_create_bulk_form',
          $type,
        ),
        'file' => 'commerce_bpc.forms.inc',
        'access callback' => 'commerce_product_access',
        'access arguments' => array(
          'create',
          commerce_product_new($type),
        ),
      );
      $items['admin/commerce/products/add-bulk/' . $type . '/display/%'] = array(
        'title' => 'Create display node',
        'title arguments' => array(
          '@name' => $product_type['name'],
        ),
        'description' => 'Create a display node for all created products',
        'page callback' => 'commerce_bpc_create_bulk_form_display_node',
        'page arguments' => array(
          $type,
          6,
        ),
        'file' => 'commerce_bpc.forms.inc',
        'type' => MENU_CALLBACK,
        'access callback' => 'commerce_product_access',
        'access arguments' => array(
          'create',
          commerce_product_new($type),
        ),
      );
    }
  }
  $items['admin/commerce/config/commerce_bpc'] = array(
    'title' => 'Bulk product creation',
    'description' => 'Settings for the bulk product creation functionality',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_bpc_pattern_settings_form',
    ),
    'access arguments' => array(
      'configure commerce bpc',
    ),
    'file' => 'commerce_bpc.admin.inc',
    'weight' => 1,
  );
  $items['admin/commerce/config/commerce_bpc/patterns'] = array(
    'title' => 'Patterns',
    'access arguments' => array(
      'configure commerce bpc',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );
  $items['admin/commerce/config/commerce_bpc/display_nodes'] = array(
    'title' => 'Display node settings',
    'description' => 'Settings for the bulk product creation display node settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'commerce_bpc_display_node_settings_form',
    ),
    'access arguments' => array(
      'configure commerce bpc',
    ),
    'file' => 'commerce_bpc.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
  );
  foreach (commerce_product_types() as $type => $product_type) {
    if (commerce_bpc_valid_product_type($type)) {
      $items['admin/commerce/products/types/' . $type . '/commerce_bpc'] = array(
        'title' => 'Bulk product creation',
        'description' => 'Settings for the bulk product creation functionality',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'commerce_bpc_pattern_settings_form',
          $type,
        ),
        'access arguments' => array(
          'configure commerce bpc',
        ),
        'file' => 'commerce_bpc.admin.inc',
        'weight' => 10,
        'type' => MENU_LOCAL_TASK,
      );
      $items['admin/commerce/products/types/' . $type . '/commerce_bpc/patterns'] = array(
        'title' => 'Patterns',
        'access arguments' => array(
          'configure commerce bpc',
        ),
        'type' => MENU_DEFAULT_LOCAL_TASK,
        'weight' => 0,
      );
      $items['admin/commerce/products/types/' . $type . '/commerce_bpc/display_nodes'] = array(
        'title' => 'Display node settings',
        'description' => 'Settings for the bulk product creation display node settings',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'commerce_bpc_display_node_settings_form',
          $type,
        ),
        'access arguments' => array(
          'configure commerce bpc',
        ),
        'file' => 'commerce_bpc.admin.inc',
        'type' => MENU_LOCAL_TASK,
        'weight' => 10,
      );
    }
  }
  return $items;
}