Commit 27f69c2d authored by alexpott's avatar alexpott
Browse files

Issue #2413461 by geertvd: Views BulkForm should add destination to go back to current page

parent 806def40
......@@ -66,7 +66,7 @@ public function testBulkForm() {
// Log in as a user with 'administer nodes' permission to have access to the
// bulk operation.
$this->drupalCreateContentType(['type' => 'page']);
$admin_user = $this->drupalCreateUser(['administer nodes', 'edit any page content']);
$admin_user = $this->drupalCreateUser(['administer nodes', 'edit any page content', 'delete any page content']);
$this->drupalLogin($admin_user);
$this->drupalGet('test_bulk_form');
......@@ -139,6 +139,18 @@ public function testBulkForm() {
$this->drupalGet('test_bulk_form');
$result = $this->xpath('//label[@for="edit-action"]');
$this->assertEqual('Test title', (string) $result[0]);
$this->drupalGet('test_bulk_form');
// Call the node delete action.
$edit = array();
for ($i = 0; $i < 5; $i++) {
$edit["node_bulk_form[$i]"] = TRUE;
}
$edit += array('action' => 'node_delete_action');
$this->drupalPostForm(NULL, $edit, t('Apply'));
$this->drupalPostForm(NULL, array(), t('Delete'));
// Check if we got redirected to the original page.
$this->assertUrl('test_bulk_form');
}
}
......@@ -283,7 +283,10 @@ public function viewsFormSubmit(&$form, FormStateInterface $form_state) {
$operation_definition = $action->getPluginDefinition();
if (!empty($operation_definition['confirm_form_route_name'])) {
$form_state->setRedirect($operation_definition['confirm_form_route_name']);
$options = array(
'query' => drupal_get_destination(),
);
$form_state->setRedirect($operation_definition['confirm_form_route_name'], array(), $options);
}
if ($count) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment