Commit 3e9a50d0 authored by alexpott's avatar alexpott

Issue #2637720 by dawehner, tim.plunkett: Ajax exposed filters + destination...

Issue #2637720 by dawehner, tim.plunkett: Ajax exposed filters + destination query don't work together
parent e770c384
......@@ -12,6 +12,8 @@
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Path\CurrentPathStack;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\RenderContext;
......@@ -161,7 +163,15 @@ public function ajaxView(Request $request) {
// Overwrite the destination.
// @see the redirect.destination service.
$origin_destination = $path;
$query = UrlHelper::buildQuery($request->query->all());
// Remove some special parameters you never want to have part of the
// destination query.
$used_query_parameters = $request->query->all();
// @todo Remove this parsing once these are removed from the request in
// https://www.drupal.org/node/2504709.
unset($used_query_parameters[FormBuilderInterface::AJAX_FORM_REQUEST], $used_query_parameters[MainContentViewSubscriber::WRAPPER_FORMAT], $used_query_parameters['ajax_page_state']);
$query = UrlHelper::buildQuery($used_query_parameters);
if ($query != '') {
$origin_destination .= '?' . $query;
}
......
......@@ -185,6 +185,10 @@ public function testAjaxView() {
$request = new Request();
$request->request->set('view_name', 'test_view');
$request->request->set('view_display_id', 'page_1');
$request->request->set('view_path', '/test-page');
$request->request->set('_wrapper_format', 'ajax');
$request->request->set('ajax_page_state', 'drupal.settings[]');
$request->request->set('type', 'article');
list($view, $executable) = $this->setupValidMocks();
......@@ -205,6 +209,10 @@ public function testAjaxView() {
$executable->displayHandlers = $display_collection;
$this->redirectDestination->expects($this->atLeastOnce())
->method('set')
->with('/test-page?type=article');
$response = $this->viewAjaxController->ajaxView($request);
$this->assertTrue($response instanceof ViewAjaxResponse);
......
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