TypeError : draggableviews_views_pre_render(): Argument #1 ($view) must be of type ViewExecutable, Drupal\views\ViewExecutable given

Created on 3 June 2024, 9 months ago

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).

Proposed resolution

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

use Drupal\views\ViewExecutable;
πŸ› Bug report
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡«πŸ‡·France gaspounet

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

Merge Requests

Comments & Activities

  • Issue created by @gaspounet
  • First commit to issue fork.
  • Merge request !41Declare use of ViewExecutable β†’ (Open) created by mandclu
  • Status changed to Needs work 9 months ago
  • πŸ‡¨πŸ‡¦Canada mandclu

    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?

  • πŸ‡«πŸ‡·France gaspounet

    Strange indeed! I had a former patch ( issue 3316975 πŸ› Contextual Link throws RouteNotFoundException: Route "view.this" does not exist Needs review ) that I removed from my composer.json file because it seems to have been merged in the 2.1.4 release

  • πŸ‡ΊπŸ‡ΈUnited States fholub13

    #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.

  • πŸ‡ΊπŸ‡ΈUnited States reddy_l

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

  • πŸ‡¬πŸ‡§United Kingdom jacobupal Leeds

    Thanks @gaspounet

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

  • Status changed to Fixed 4 months ago
  • πŸ‡¨πŸ‡¦Canada iStryker

    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.

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

Production build 0.71.5 2024