Appropriately deal with Error: Call to a member function isAllowed() on bool

Created on 9 June 2024, 7 months ago
Updated 12 July 2024, 6 months ago

Problem/Motivation

Running VBO add to cart generates this error:
Error: Call to a member function isAllowed() on bool in Drupal\views_bulk_operations\Service\ViewsBulkOperationsActionProcessor->process() (line 448 of /var/www/.../web/modules/contrib/views_bulk_operations/src/Service/ViewsBulkOperationsActionProcessor.php).

Proposed resolution

The function should return an object instead of a boolean operator.

Remaining tasks

The following changes within ViewsBulkAddToCartAction.php solve the problem:

Add this line to the use declarations of the ViewsBulkAddToCartAction.php file:
use Drupal\Core\Access\AccessResult;

In the ViewsBulkAddToCartAction.php action plugin

replace this line
return TRUE;

with this:
return AccessResult::allowed();

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇮🇪Ireland marksmith

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024