Fix the Cancel button not appearing on the config step. Use ->get_url() instead of...
authorBojan Zivanovic
Sat, 2 Jul 2011 15:58:17 +0000 (17:58 +0200)
committerBojan Zivanovic
Sat, 2 Jul 2011 15:58:17 +0000 (17:58 +0200)
views_bulk_operations.module

index 321c8e8..9cb9e4c 100644 (file)
@@ -326,17 +326,17 @@ function views_bulk_operations_form($form, &$form_state, $vbo) {
 function views_bulk_operations_config_form($form, &$form_state, $view, $output) {
   $vbo = _views_bulk_operations_get_field($view);
   $operation = $vbo->get_operation_info($form_state['views_bulk_operations']['views_form_views_form']['operation']);
+  $query = drupal_get_query_parameters($_GET, array('q'));
   $form['operation'] = array('#type' => 'value', '#value' => $operation);
-  $form['execute'] = array(
+  $form['actions'] = array(
+    '#type' => 'container',
+    '#attributes' => array('class' => array('form-actions')),
+    '#weight' => 100,
+  );
+  $form['actions']['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Next'),
-    '#weight' => 98,
-  );
-  $query = $vbo->view->get_exposed_input();
-  $form['cancel'] = array(
-    '#type' => 'markup',
-    '#value' => t('<a href="@view">Cancel</a>', array('@view' => url($_GET['q'], array('query' => $query)))),
-    '#weight' => 99,
+    '#suffix' => l(t('Cancel'), $vbo->view->get_url(), array('query' => $query)),
   );
   drupal_set_title(t('Set parameters for %action', array('%action' => $operation['label'])), PASS_THROUGH);
 
@@ -358,9 +358,10 @@ function views_bulk_operations_confirm_form($form, &$form_state, $view, $output)
   $vbo = _views_bulk_operations_get_field($view);
   $operation = $vbo->get_operation_info($form_state['views_bulk_operations']['views_form_views_form']['operation']);
   $rows = $form_state['views_bulk_operations']['views_form_views_form']['selection'];
+  $query = drupal_get_query_parameters($_GET, array('q'));
   $form = confirm_form($form,
     t('Are you sure you want to perform %action on selected rows?', array('%action' => $operation['label'])),
-    array('path' => $_GET['q'], 'query' => $view->get_exposed_input()),
+    array('path' => $view->get_url(), 'query' => $query),
     theme('views_bulk_operations_confirmation', array('rows' => $rows, 'vbo' => $vbo))
   );
 
@@ -561,8 +562,8 @@ function views_bulk_operations_form_submit($form, &$form_state) {
   unset($form_state['step']);
   unset($form_state['views_bulk_operations']);
 
-  $exposed_input = $vbo->view->get_exposed_input();
-  $form_state['redirect'] = array('path' => $_GET['q'], array('query' => $exposed_input));
+  $query = drupal_get_query_parameters($_GET, array('q'));
+  $form_state['redirect'] = array('path' => $vbo->view->get_url(), array('query' => $query));
 }
 
 /**