Drupal 10.1 breaks viewsreference Ajax views

Created on 25 July 2023, 11 months ago
Updated 7 August 2023, 11 months ago

Problem/Motivation

When using ajax views the dynamic views reference setting plugins do not apply their changes to the results. For example when you enable a pager for the view, the code in the field formatter does not run.

I tested this on a fresh Drupal 10.1 and could reproduce it there. On Drupal 10.0 I was not able to reproduce it.

Steps to reproduce

  • Install a fresh Drupal 10.1
  • Install latest 2.x Viewsreference
  • Create a view which has Ajax enabled (default no pagination)
  • Create a field with Viewsreference
  • Create a page with Viewsreference (set Full or Mini pagination)
  • After clicking on next page in pagination, all Viewsreference settings are lost

Proposed resolution

In viewsreference_views_pre_view():

Change:

$view->getRequest()->request->all('viewsreference')

to:

$view->getRequest()->query->all('viewsreference')

This seems to fix the issue.

I could not find what exact change in Drupal core 10.1 broke this, maybe anyone else knows?

If you are applying the patch to 8.x-2.0-beta4 you must first apply the patch for πŸ› Ajax pager - Input value "viewsreference" contains a non-scalar value Fixed first or this patch will not apply.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024