diff --git a/node_gallery_api.module b/node_gallery_api.module index 15ee010..7fe852f 100644 --- a/node_gallery_api.module +++ b/node_gallery_api.module @@ -156,7 +156,7 @@ function node_gallery_api_menu() { ); - $primary_item_type = NULL; + $item_types = array(); $relationship_types = node_gallery_api_get_relationship_type(NULL, NULL, NULL, TRUE); if (!empty($relationship_types)) { foreach ($relationship_types as $relationship) { @@ -170,9 +170,9 @@ function node_gallery_api_menu() { 'access arguments' => array(1, $item_type), 'file' => 'node_gallery_api.pages.inc', 'weight' => -2, - 'type' => (empty($primary_item_type)) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, + 'type' => (empty($item_types)) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, ); - $primary_item_type = $item_type; + $item_types[] = $item_type; } } } @@ -180,9 +180,9 @@ function node_gallery_api_menu() { $items['node/%node_gallery_api_gallery/upload'] = array( 'title' => 'Upload New Items', 'page callback' => 'node_gallery_api_upload_items_form', - 'page arguments' => array(1, $primary_item_type), + 'page arguments' => array(1), 'access callback' => 'node_gallery_api_upload_access', - 'access arguments' => array(1, $primary_item_type), + 'access arguments' => array(1), 'file' => 'node_gallery_api.pages.inc', 'weight' => -2, 'type' => MENU_LOCAL_TASK, @@ -206,7 +206,7 @@ function node_gallery_api_permission() { /** * Access function for uploads. */ -function node_gallery_api_upload_access($gallery, $item_type) { +function node_gallery_api_upload_access($gallery, $item_type = NULL) { $relationship_types = node_gallery_api_get_relationship_type($gallery->type, $item_type); return (!empty($relationship_types) && node_gallery_api_user_access('upload', $gallery)); } diff --git a/node_gallery_api.pages.inc b/node_gallery_api.pages.inc index 66ac1f7..8e0c4e3 100644 --- a/node_gallery_api.pages.inc +++ b/node_gallery_api.pages.inc @@ -585,13 +585,16 @@ function node_gallery_api_flatten_item_edit_form($form_item, &$flattened = array * @return string * HTML output. */ -function node_gallery_api_upload_items_form($gallery, $item_type) { +function node_gallery_api_upload_items_form($gallery, $item_type = NULL) { global $user; if ($gallery->nid > 0) { // node_gallery_set_user_breadcrumb($gallery->uid, $gallery); } $relationship_type = node_gallery_api_get_relationship_type($gallery->type); + if (empty($item_type)) { + $item_type = $relationship_type->item_types[0]; + } if (module_exists('plupload') && variable_get('node_gallery_api_plupload_integration', TRUE)) { if (!empty($gallery->edit_after_plupload)) {