View form is making issues when some module implements hook_menu_alter() and relocate the menu entry that is of a particular views display.

Here is the make file to produce environment with this issue:

core = 7.x
api = 2

; Core
projects[drupal][version] = "7.39"

; Modules
projects[views_bulk_operations][version] = "3.3"
projects[admin_views][version] = "1.5"
projects[ctools][version] = "1.9"
projects[entity][version] = "1.6"
projects[file_entity][version] = "2.0-beta2"
projects[media][version] = "2.0-beta1"
projects[media_browser_plus][version] = "3.0-beta3"
projects[multiform][version] = "1.1"
projects[views][version] = "3.11"
projects[views_tree][version] = "2.0"
  1. Install 'media_browser_plus' module.
  2. Create one or more file entities using path 'file/add'. We are going to try deleting them using VBO.
  3. Go to path 'admin/content/file/list' and select one or more files.
  4. From 'Operations', select 'Delete' and press 'Execute'.
  5. You will get directed to path 'admin/content/file' instead of showing delete confirmation for VBO and that is the issue
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

junaidpv created an issue. See original summary.

junaidpv’s picture

Status: Active » Needs review
FileSize
488 bytes

In my above example it happens because media_browser_plus module menu alters path of 'admin_views_file' views from 'admin/content/file' to 'admin/content/file/list' and views form generation still sets 'admin/content/file' as forms action path.

Here is the simple patch that remove lines that set #action property of form manually. Will it make any further problems?

Even with this given patch, it will not get properly redirected back to original page after VBO. That is because similar issue in VBO module. Here is the change correcting that part:

diff --git a/views_bulk_operations.module b/views_bulk_operations.module
index 49ccf55..fc95f46 100644
--- a/views_bulk_operations.module
+++ b/views_bulk_operations.module
@@ -732,7 +732,7 @@ function views_bulk_operations_form_submit($form, &$form_state) {
 
   // Redirect.
   $query = drupal_get_query_parameters($_GET, array('q'));
-  $form_state['redirect'] = array('path' => $vbo->view->get_url(), array('query' => $query));
+  $form_state['redirect'] = array('path' => request_path(), array('query' => $query));
 }
 
 /**

Please provide your valuable inputs to this.

Chris Matthews’s picture

The 3 year old patch in #2 to views.module applied cleanly to the latest views 7.x-3.x-dev and if still relevant needs to be reviewed.