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

8.0.x
Alex Pott 2015-02-19 09:22:59 +00:00
parent 806def404d
commit 27f69c2df5
2 changed files with 17 additions and 2 deletions

View File

@ -66,7 +66,7 @@ class BulkFormTest extends WebTestBase {
// 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 @@ class BulkFormTest extends WebTestBase {
$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');
}
}

View File

@ -283,7 +283,10 @@ class BulkForm extends FieldPluginBase {
$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) {