You are here

function bpc_display_menu in Commerce Bulk Product Creation 7.2

Implements hook_menu().

File

modules/bpc_display/bpc_display.module, line 10
Allows automatic display node creation for Commerce bulk product creation.

Code

function bpc_display_menu() {
  $items = array();
  $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(
      'bpc_display_settings_form',
    ),
    'access arguments' => array(
      'configure commerce bpc',
    ),
    'file' => 'bpc_display.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
  );
  foreach (commerce_product_types() as $type => $product_type) {
    if (commerce_bpc_valid_product_type($type)) {

      // The display node type selection page.
      $items['admin/commerce/products/add-bulk/' . $type . '/display/%'] = array(
        'title' => 'Create display node',
        'description' => 'Create a display node for all created products',
        'page callback' => 'bpc_display_select_node_type',
        'page arguments' => array(
          $type,
          6,
        ),
        'file' => 'bpc_display.forms.inc',
        'type' => MENU_CALLBACK,
        // We only check access for product creation here, as the node module
        // does its own access checks (and denying access here would only
        // confuse users / site builders).
        'access callback' => 'commerce_product_access',
        'access arguments' => array(
          'create',
          commerce_product_new($type),
        ),
      );

      // Product type specific settings pages.
      $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(
          'bpc_display_settings_form',
          $type,
        ),
        'access arguments' => array(
          'configure commerce bpc',
        ),
        'file' => 'bpc_display.admin.inc',
        'type' => MENU_LOCAL_TASK,
        'weight' => 10,
      );
    }
  }
  return $items;
}