Problem/Motivation

Drupal 10.2.6, PHP 8.3.7 and DraggableViews 2.1.4

I've got the following error message when I edit any of my views from Views UI even for the views where Draggable Views is not used:

TypeError : draggableviews_views_pre_render(): Argument #1 ($view) must be of type ViewExecutable, Drupal\views\ViewExecutable given in draggableviews_views_pre_render() (line 276 of /<DRUPAL_ROOT-DIR>/web/modules/contrib/draggableviews/draggableviews.module).

Temporary Workaround

Adding the following line at the top of draggableviews.module seems to solve the issue:

use Drupal\views\ViewExecutable;

This problem is fixed in 2.1.x-dev and will be fixed in the next release after 2.1.4 (currently, this is no release after 2.1.4 yet).

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gaspounet created an issue. See original summary.

mandclu made their first commit to this issue’s fork.

mandclu’s picture

Status: Active » Needs work

This is a strange one. I can't reproduce the cited error, and having put your suggested fix into an MR, phpcs throws an error on the declared use of ViewExecutable as unused. I also notice that the error statement referred to draggableviews_views_pre_render(), which isn't present in the draggableviews.module file in 2.1.4, and it says the error is on line 276, where the file in 2.1.4 ends on line 270. Do you have a patch applied to the 2.1.4 release?

gaspounet’s picture

Strange indeed! I had a former patch (issue 3316975) that I removed from my composer.json file because it seems to have been merged in the 2.1.4 release

EDIT:

removing the modules/contrib/draggableviews folder and running composer install again did the trick, the draggableviews_views_pre_render() is not present anymore and the draggableviews.module ends now on line 270

Sorry for the false alarm, I thought the module updating process replaced all the previous files

fholub13’s picture

#5 was my exact experience as well. I had the aforementioned former patch installed (3316975-15) on a client site and was experiencing the error detailed in this issue. Removing the patch, deleting the module directory, and running a new composer install remedied the error.

reddy_l’s picture

I am also getting the same error with 2.1.4 version of module. Attached patch fixed the issue

jacobupal’s picture

Thanks @gaspounet

Incidentally, composer reinstall drupal/draggableviews also achieves the same thing, i.e. deleting the directory before installing the module with patches etc.

istryker’s picture

Status: Needs work » Fixed

I am going to mark this as fixed because of https://git.drupalcode.org/project/draggableviews/-/commit/d1a4a588dceae...

It adds the "Use" of viewExecutable and adds function draggableviews_views_pre_render(ViewExecutable $view) {

Oddly, I checked and did not see draggalbeviews_views_pre_render in any of the last tag versions (2.0.2->2.1.4). This makes me think everyone uses a patched version (some people hinted at it). Going from the patch version to 2.1.4 will remain broken. Going from the patched version to the next release (2.1.5, maybe) will not be an issue.

istryker’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.