You are here

function multi_node_add_menu in Multi Node Add 7

Same name and namespace in other branches
  1. 6 multi_node_add.module \multi_node_add_menu()

Implements hook_menu().

File

./multi_node_add.module, line 12
Allows to create multiple nodes using one page, one form submission. Highly depends on Javascript.

Code

function multi_node_add_menu() {
  $items = array();
  $items['multi_node_add'] = array(
    'title' => 'Create multiple nodes',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'multi_node_add_page',
    ),
    'access callback' => '_node_add_access',
    'file' => 'multi_node_add.pages.inc',
  );
  foreach (node_type_get_types() as $type) {
    $type_url_str = str_replace('_', '-', $type->type);
    $items['multi_node_add/' . $type_url_str] = array(
      'title' => drupal_ucfirst($type->name),
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'multi_node_add_page',
        1,
      ),
      'access callback' => 'node_access',
      'access arguments' => array(
        'create',
        $type->type,
      ),
      'description' => $type->description,
      'type' => MENU_LOCAL_TASK,
      'file' => 'multi_node_add.pages.inc',
    );
    $items['multi_node_add/frame/' . $type_url_str] = array(
      'type' => MENU_CALLBACK,
      'access callback' => 'node_access',
      'access arguments' => array(
        'create',
        $type->type,
      ),
      'page callback' => 'multi_node_add_frame_page',
      'page arguments' => array(
        $type->type,
      ),
      'file' => 'multi_node_add.pages.inc',
    );
    $items['multi_node_add/status/' . $type_url_str . '/%node/%'] = array(
      'type' => MENU_CALLBACK,
      'access callback' => 'node_access',
      'access arguments' => array(
        'create',
        $type->type,
      ),
      'page callback' => 'multi_node_add_frame_status',
      'page arguments' => array(
        3,
        4,
      ),
      'file' => 'multi_node_add.pages.inc',
    );
  }
  return $items;
}