diff --git a/core/lib/Drupal/Core/Routing/RedirectDestinationTrait.php b/core/lib/Drupal/Core/Routing/RedirectDestinationTrait.php index 4ecdcde..47d284d 100644 --- a/core/lib/Drupal/Core/Routing/RedirectDestinationTrait.php +++ b/core/lib/Drupal/Core/Routing/RedirectDestinationTrait.php @@ -40,7 +40,7 @@ * If the query parameter isn't present, then the URL of the current * request is returned. */ - protected function getDestination() { + protected function getDestinationArray() { return $this->getRedirectDestination()->getAsArray(); } diff --git a/core/modules/book/src/Form/BookAdminEditForm.php b/core/modules/book/src/Form/BookAdminEditForm.php index ebeeba9..9df174d 100644 --- a/core/modules/book/src/Form/BookAdminEditForm.php +++ b/core/modules/book/src/Form/BookAdminEditForm.php @@ -206,7 +206,7 @@ protected function bookAdminTableTree(array $tree, array &$form) { $delta = ($count < 30) ? 15 : intval($count / 2) + 1; $access = \Drupal::currentUser()->hasPermission('administer nodes'); - $destination = $this->getDestination(); + $destination = $this->getDestinationArray(); foreach ($tree as $data) { $nid = $data['link']['nid']; diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php index e8b726e..c5108c7 100644 --- a/core/modules/comment/src/Form/CommentAdminOverview.php +++ b/core/modules/comment/src/Form/CommentAdminOverview.php @@ -167,7 +167,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $type = ' // Build a table listing the appropriate comments. $options = array(); - $destination = $this->getDestination(); + $destination = $this->getDestinationArray(); $commented_entity_ids = array(); $commented_entities = array(); diff --git a/core/modules/comment/src/Plugin/views/field/LinkApprove.php b/core/modules/comment/src/Plugin/views/field/LinkApprove.php index bd8a4be..11e7812 100644 --- a/core/modules/comment/src/Plugin/views/field/LinkApprove.php +++ b/core/modules/comment/src/Plugin/views/field/LinkApprove.php @@ -53,7 +53,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['url'] = Url::fromRoute('comment.approve', ['comment' => $comment->id()]); - $this->options['alter']['query'] = $this->getDestination() + array('token' => \Drupal::csrfToken()->get($this->options['alter']['url']->toString())); + $this->options['alter']['query'] = $this->getDestinationArray() + array('token' => \Drupal::csrfToken()->get($this->options['alter']['url']->toString())); return $text; } diff --git a/core/modules/comment/src/Plugin/views/field/LinkDelete.php b/core/modules/comment/src/Plugin/views/field/LinkDelete.php index c37644c..5ede03f 100644 --- a/core/modules/comment/src/Plugin/views/field/LinkDelete.php +++ b/core/modules/comment/src/Plugin/views/field/LinkDelete.php @@ -44,7 +44,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['url'] = $comment->urlInfo('delete-form'); - $this->options['alter']['query'] = $this->getDestination(); + $this->options['alter']['query'] = $this->getDestinationArray(); return $text; } diff --git a/core/modules/comment/src/Plugin/views/field/LinkEdit.php b/core/modules/comment/src/Plugin/views/field/LinkEdit.php index c70024e..7ae0693 100644 --- a/core/modules/comment/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/comment/src/Plugin/views/field/LinkEdit.php @@ -60,7 +60,7 @@ protected function renderLink($data, ResultRow $values) { unset($this->options['alter']['fragment']); if (!empty($this->options['destination'])) { - $this->options['alter']['query'] = $this->getDestination(); + $this->options['alter']['query'] = $this->getDestinationArray(); } $this->options['alter']['url'] = $comment->urlInfo('edit-form'); diff --git a/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php b/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php index 20ca2dd..5c47776 100644 --- a/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php +++ b/core/modules/contextual/src/Plugin/views/field/ContextualLinks.php @@ -122,7 +122,7 @@ public function render(ResultRow $values) { 'title' => $title, ); if (!empty($this->options['destination'])) { - $links[$field]['query'] = $this->getDestination(); + $links[$field]['query'] = $this->getDestinationArray(); } } } diff --git a/core/modules/field_ui/src/Form/FieldEditForm.php b/core/modules/field_ui/src/Form/FieldEditForm.php index bfcff1f..6d444f8 100644 --- a/core/modules/field_ui/src/Form/FieldEditForm.php +++ b/core/modules/field_ui/src/Form/FieldEditForm.php @@ -219,7 +219,7 @@ public function delete(array &$form, FormStateInterface $form_state) { $destination = array(); $request = $this->getRequest(); if ($request->query->has('destination')) { - $destination = $this->getDestination(); + $destination = $this->getDestinationArray(); $request->query->remove('destination'); } $entity_type = $this->entityManager->getDefinition($this->field->entity_type); diff --git a/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php index 9b42c90..b26c225 100644 --- a/core/modules/field_ui/src/Form/FieldStorageAddForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php @@ -417,7 +417,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } if ($destinations) { - $destination = $this->getDestination(); + $destination = $this->getDestinationArray(); $destinations[] = $destination['destination']; $form_state->setRedirectUrl(FieldUI::getNextDestination($destinations, $form_state)); } diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php index 91cd8f0..09f529a 100644 --- a/core/modules/menu_ui/src/MenuForm.php +++ b/core/modules/menu_ui/src/MenuForm.php @@ -383,7 +383,7 @@ protected function buildOverviewTreeForm($tree, $delta) { if ($edit_route) { $operations['edit']['url'] = $edit_route; // Bring the user back to the menu overview. - $operations['edit']['query'] = $this->getDestination(); + $operations['edit']['query'] = $this->getDestinationArray(); } else { // Fall back to the standard edit link. @@ -400,7 +400,7 @@ protected function buildOverviewTreeForm($tree, $delta) { } elseif ($delete_link = $link->getDeleteRoute()) { $operations['delete']['url'] = $delete_link; - $operations['delete']['query'] = $this->getDestination(); + $operations['delete']['query'] = $this->getDestinationArray(); $operations['delete']['title'] = $this->t('Delete'); } if ($link->isTranslatable()) { diff --git a/core/modules/node/src/Plugin/views/field/LinkDelete.php b/core/modules/node/src/Plugin/views/field/LinkDelete.php index 16d32a8..6dad5e0 100644 --- a/core/modules/node/src/Plugin/views/field/LinkDelete.php +++ b/core/modules/node/src/Plugin/views/field/LinkDelete.php @@ -38,7 +38,7 @@ protected function renderLink($node, ResultRow $values) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['url'] = $node->urlInfo('delete-form'); - $this->options['alter']['query'] = $this->getDestination(); + $this->options['alter']['query'] = $this->getDestinationArray(); $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete'); return $text; diff --git a/core/modules/node/src/Plugin/views/field/LinkEdit.php b/core/modules/node/src/Plugin/views/field/LinkEdit.php index 364c82b..6d46642 100644 --- a/core/modules/node/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/node/src/Plugin/views/field/LinkEdit.php @@ -39,7 +39,7 @@ protected function renderLink($node, ResultRow $values) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['url'] = $node->urlInfo('edit-form'); - $this->options['alter']['query'] = $this->getDestination(); + $this->options['alter']['query'] = $this->getDestinationArray(); $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); return $text; diff --git a/core/modules/node/src/Plugin/views/field/RevisionLink.php b/core/modules/node/src/Plugin/views/field/RevisionLink.php index c66684c..8370170 100644 --- a/core/modules/node/src/Plugin/views/field/RevisionLink.php +++ b/core/modules/node/src/Plugin/views/field/RevisionLink.php @@ -66,7 +66,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['url'] = $url; - $this->options['alter']['query'] = $this->getDestination(); + $this->options['alter']['query'] = $this->getDestinationArray(); return !empty($this->options['text']) ? $this->options['text'] : $this->t('View'); } diff --git a/core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php b/core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php index 32a94f0..c7519d0 100644 --- a/core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php +++ b/core/modules/node/src/Plugin/views/field/RevisionLinkDelete.php @@ -52,7 +52,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['url'] = Url::fromRoute('node.revision_delete_confirm', ['node' => $node->id(), 'node_revision' => $vid]); - $this->options['alter']['query'] = $this->getDestination(); + $this->options['alter']['query'] = $this->getDestinationArray(); return !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete'); } diff --git a/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php b/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php index ac28c6d..a5d1c97 100644 --- a/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php +++ b/core/modules/node/src/Plugin/views/field/RevisionLinkRevert.php @@ -52,7 +52,7 @@ protected function renderLink($data, ResultRow $values) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['url'] = Url::fromRoute('node.revision_revert_confirm', ['node' => $node->id(), 'node_revision' => $vid]); - $this->options['alter']['query'] = $this->getDestination(); + $this->options['alter']['query'] = $this->getDestinationArray(); return !empty($this->options['text']) ? $this->options['text'] : $this->t('Revert'); } diff --git a/core/modules/path/src/Controller/PathController.php b/core/modules/path/src/Controller/PathController.php index 2d51281..cdb596d 100644 --- a/core/modules/path/src/Controller/PathController.php +++ b/core/modules/path/src/Controller/PathController.php @@ -83,7 +83,7 @@ public function adminOverview(Request $request) { $header[] = $this->t('Operations'); $rows = array(); - $destination = $this->getDestination(); + $destination = $this->getDestinationArray(); foreach ($this->aliasStorage->getAliasesForAdminListing($header, $keys) as $data) { $row = array(); // @todo Should Path module store leading slashes? See diff --git a/core/modules/path/src/Form/EditForm.php b/core/modules/path/src/Form/EditForm.php index 896aa77..1f8297a 100644 --- a/core/modules/path/src/Form/EditForm.php +++ b/core/modules/path/src/Form/EditForm.php @@ -58,7 +58,7 @@ public function deleteSubmit(array &$form, FormStateInterface $form_state) { )); if ($this->getRequest()->query->has('destination')) { - $url->setOption('query', $this->getDestination()); + $url->setOption('query', $this->getDestinationArray()); $this->getRequest()->query->remove('destination'); } diff --git a/core/modules/system/src/Plugin/views/field/BulkForm.php b/core/modules/system/src/Plugin/views/field/BulkForm.php index 964b2bd..b67bf8a 100644 --- a/core/modules/system/src/Plugin/views/field/BulkForm.php +++ b/core/modules/system/src/Plugin/views/field/BulkForm.php @@ -287,7 +287,7 @@ public function viewsFormSubmit(&$form, FormStateInterface $form_state) { $operation_definition = $action->getPluginDefinition(); if (!empty($operation_definition['confirm_form_route_name'])) { $options = array( - 'query' => $this->getDestination(), + 'query' => $this->getDestinationArray(), ); $form_state->setRedirect($operation_definition['confirm_form_route_name'], array(), $options); } diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php index dbb14b1..eebbacc 100644 --- a/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -200,7 +200,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular } $errors = $form_state->getErrors(); - $destination = $this->getDestination(); + $destination = $this->getDestinationArray(); $row_position = 0; // Build the actual form. $form['terms'] = array( diff --git a/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php b/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php index 7581c00..10f0337 100644 --- a/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php @@ -81,7 +81,7 @@ public function render(ResultRow $values) { )); if ($term->access('update')) { $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); - return \Drupal::l($text, new Url('entity.taxonomy.edit_form', ['taxonomy_term' => $tid], array('query' => $this->getDestination()))); + return \Drupal::l($text, new Url('entity.taxonomy.edit_form', ['taxonomy_term' => $tid], array('query' => $this->getDestinationArray()))); } } } diff --git a/core/modules/user/src/Plugin/Block/UserLoginBlock.php b/core/modules/user/src/Plugin/Block/UserLoginBlock.php index 9a0efb5..d0f84c6 100644 --- a/core/modules/user/src/Plugin/Block/UserLoginBlock.php +++ b/core/modules/user/src/Plugin/Block/UserLoginBlock.php @@ -89,7 +89,7 @@ public function build() { unset($form['pass']['#description']); $form['name']['#size'] = 15; $form['pass']['#size'] = 15; - $form['#action'] = $this->url('', [], ['query' => $this->getDestination(), 'external' => FALSE]); + $form['#action'] = $this->url('', [], ['query' => $this->getDestinationArray(), 'external' => FALSE]); // Build action links. $items = array(); if (\Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) { diff --git a/core/modules/user/src/Plugin/views/field/LinkCancel.php b/core/modules/user/src/Plugin/views/field/LinkCancel.php index 1d307d4..b29c426 100644 --- a/core/modules/user/src/Plugin/views/field/LinkCancel.php +++ b/core/modules/user/src/Plugin/views/field/LinkCancel.php @@ -29,7 +29,7 @@ protected function renderLink(EntityInterface $entity, ResultRow $values) { $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Cancel account'); $this->options['alter']['url'] = $entity->urlInfo('cancel-form'); - $this->options['alter']['query'] = $this->getDestination(); + $this->options['alter']['query'] = $this->getDestinationArray(); return $text; } diff --git a/core/modules/user/src/Plugin/views/field/LinkEdit.php b/core/modules/user/src/Plugin/views/field/LinkEdit.php index 2683a3e..23a4f5a 100644 --- a/core/modules/user/src/Plugin/views/field/LinkEdit.php +++ b/core/modules/user/src/Plugin/views/field/LinkEdit.php @@ -28,7 +28,7 @@ protected function renderLink(EntityInterface $entity, ResultRow $values) { $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); - $this->options['alter']['url'] = $entity->urlInfo('edit-form', ['query' => ['destination' => $this->getDestination()]]); + $this->options['alter']['url'] = $entity->urlInfo('edit-form', ['query' => ['destination' => $this->getDestinationArray()]]); return $text; } diff --git a/core/modules/views/src/Plugin/views/field/EntityOperations.php b/core/modules/views/src/Plugin/views/field/EntityOperations.php index 7678cae..35fbfc3 100644 --- a/core/modules/views/src/Plugin/views/field/EntityOperations.php +++ b/core/modules/views/src/Plugin/views/field/EntityOperations.php @@ -105,7 +105,7 @@ public function render(ResultRow $values) { if (!isset($operation['query'])) { $operation['query'] = array(); } - $operation['query'] += $this->getDestination(); + $operation['query'] += $this->getDestinationArray(); } } $build = array( diff --git a/core/modules/views/src/Tests/Plugin/views/field/EntityOperationsUnitTest.php b/core/modules/views/src/Tests/Plugin/views/field/EntityOperationsUnitTest.php index 0f9ab96..60cea67 100644 --- a/core/modules/views/src/Tests/Plugin/views/field/EntityOperationsUnitTest.php +++ b/core/modules/views/src/Tests/Plugin/views/field/EntityOperationsUnitTest.php @@ -46,10 +46,10 @@ public function setUp() { $this->plugin = $this->getMockBuilder('Drupal\views\Plugin\views\field\EntityOperations') ->setConstructorArgs([$configuration, $plugin_id, $plugin_definition, $this->entityManager]) - ->setMethods(array('getDestination')) + ->setMethods(array('getDestinationArray')) ->getMock(); $this->plugin->expects($this->any()) - ->method('getDestination') + ->method('getDestinationArray') ->willReturn(['destination' => 'foobar']); $view = $this->getMockBuilder('\Drupal\views\ViewExecutable')