Error when Trash Module is also installed.

Created on 27 March 2025, 6 days ago

Problem/Motivation

When you have a content type that is using workflows / content moderation, revisions, workbench_email, and the trash module enabled, an error happens when trying to move an item into the trash bin.

TypeError: Drupal\content_moderation\ModerationInformation::isModeratedEntity(): Argument #1 ($entity) must be of type Drupal\Core\Entity\EntityInterface, null given, called in /var/www/html/web/modules/contrib/workbench_email/workbench_email.module on line 118

Steps to reproduce

  1. Create a content type, a workflow, and assign the content type to the workflow.
  2. Enable workbench Email and Trash module.
  3. Create a new piece of content. State (published, draft, etc). does not matter.
  4. Try to delete the content, evoking the Trash module to move it into trash rather than actually deleting it.
  5. Error happens.

Proposed resolution

The problem is that on line 110 of workbench_email.module, the entity coming back when it intercepts during the Trash moving process isn't a typeof EntityInterface. I propose having a check to make sure that what is loaded is of that type.

I have created a patch file to help with this.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ACoolDevDude California

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