Ajax Library added to view if Ajax disabled

Created on 28 January 2022, almost 3 years ago
Updated 16 March 2024, 10 months ago

Problem/Motivation

Looking at the code of views_show_more/src/Plugin/views/pager/ShowMore.php::render(), the view display's usesAJAX() method is used to determine if AJAX is enabled and if so add the required library to the view for the pager to work with AJAX. However, on a view display with the Use AJAX option set to FALSE, usesAJAX() still returns TRUE: presumably this is some kind of flag as to whether the view CAN use AJAX and not one of whether it DOES use AJAX.

Steps to reproduce

Create a view with a Show More page and set the Use AJAX option to FALSE. When viewed, the view will have the Views Show More library attached to it.

Proposed resolution

The alternative method ->ajaxEnabled() returns the value of the Use Ajax? option on the view. I'd suggest the code be updated to use this method instead, but I'm not sure if there was some reason I'm not aware of for usersAJAX() being used so it would require some input from the maintainer.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom MrDaleSmith

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024