comparison core/modules/views/src/Controller/ViewAjaxController.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
130 130
131 $response = new ViewAjaxResponse(); 131 $response = new ViewAjaxResponse();
132 132
133 // Remove all of this stuff from the query of the request so it doesn't 133 // Remove all of this stuff from the query of the request so it doesn't
134 // end up in pagers and tablesort URLs. 134 // end up in pagers and tablesort URLs.
135 foreach (['view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', AjaxResponseSubscriber::AJAX_REQUEST_PARAMETER] as $key) { 135 // @todo Remove this parsing once these are removed from the request in
136 // https://www.drupal.org/node/2504709.
137 foreach ([
138 'view_name',
139 'view_display_id',
140 'view_args',
141 'view_path',
142 'view_dom_id',
143 'pager_element',
144 'view_base_path',
145 AjaxResponseSubscriber::AJAX_REQUEST_PARAMETER,
146 FormBuilderInterface::AJAX_FORM_REQUEST,
147 MainContentViewSubscriber::WRAPPER_FORMAT,
148 ] as $key) {
136 $request->query->remove($key); 149 $request->query->remove($key);
137 $request->request->remove($key); 150 $request->request->remove($key);
138 } 151 }
139 152
140 // Load the view. 153 // Load the view.
150 } 163 }
151 164
152 // Add all POST data, because AJAX is always a post and many things, 165 // Add all POST data, because AJAX is always a post and many things,
153 // such as tablesorts, exposed filters and paging assume GET. 166 // such as tablesorts, exposed filters and paging assume GET.
154 $request_all = $request->request->all(); 167 $request_all = $request->request->all();
168 unset($request_all['ajax_page_state']);
155 $query_all = $request->query->all(); 169 $query_all = $request->query->all();
156 $request->query->replace($request_all + $query_all); 170 $request->query->replace($request_all + $query_all);
157 171
158 // Overwrite the destination. 172 // Overwrite the destination.
159 // @see the redirect.destination service. 173 // @see the redirect.destination service.
160 $origin_destination = $path; 174 $origin_destination = $path;
161 175
162 // Remove some special parameters you never want to have part of the
163 // destination query.
164 $used_query_parameters = $request->query->all(); 176 $used_query_parameters = $request->query->all();
165 // @todo Remove this parsing once these are removed from the request in
166 // https://www.drupal.org/node/2504709.
167 unset($used_query_parameters[FormBuilderInterface::AJAX_FORM_REQUEST], $used_query_parameters[MainContentViewSubscriber::WRAPPER_FORMAT], $used_query_parameters['ajax_page_state']);
168
169 $query = UrlHelper::buildQuery($used_query_parameters); 177 $query = UrlHelper::buildQuery($used_query_parameters);
170 if ($query != '') { 178 if ($query != '') {
171 $origin_destination .= '?' . $query; 179 $origin_destination .= '?' . $query;
172 } 180 }
173 $this->redirectDestination->set($origin_destination); 181 $this->redirectDestination->set($origin_destination);