- π΅π±Poland sayco ToruΕ
My issue is partially related to the topic, but still, I'm here because of that piece of code
// Remove all of this stuff from the query of the request so it doesn't // end up in pagers and tablesort URLs. // @todo Remove this parsing once these are removed from the request in // https://www.drupal.org/node/2504709. foreach ([ 'view_name', 'view_display_id', 'view_args', 'view_path', 'view_dom_id', 'pager_element', 'view_base_path', AjaxResponseSubscriber::AJAX_REQUEST_PARAMETER, FormBuilderInterface::AJAX_FORM_REQUEST, MainContentViewSubscriber::WRAPPER_FORMAT, ] as $key) { $request->query->remove($key); $request->request->remove($key); }
I really need access to the original data from the request (as for many of you my $form['#action'] is incorrect).
My proposal to sort this out is to clone the request object and push it to the request stack.
Thanks to that we can still get the main/master request and the current one.In my case, I just simply wrote the Route Subscriber and alter the `views.ajax`
route with a custom controller.
In the controller I simply do the following:/** * {@inheritdoc} */ public function ajaxView(Request $request) { $request = clone($request); $this->requestStack->push($request); return parent::ajaxView($request); }
The view is working without any issues (at least seem to be working fine), and I'm able to now do whatever I want with the data from the main request by
$request = $this->requestStack->getMainRequest();
I hope this workaround will somehow help you with finding the right solution.
- π¬π§United Kingdom catch
π ajax_page_state leaks through request in Views Ajax Needs work may have changed things here a bit.