Error: Call to a member function getTypePlugin() on null in Drupal\content_moderation\StateTransitionValidation->getValidTransitions() - Error on non moderated entities

Created on 5 August 2025, 18 days ago

Problem/Motivation

The module assumes that any entity it accesses via hook will be moderated.
Not all entities on a site are always moderated;

This line:
$transition = $validator->getValidTransitions($entity, $currentUser);

throws a php error even for entity reference fields when rendered anywhere.

Steps to reproduce

Enable the module and try to view a node of non-moderated type

Proposed resolution

Check for moderation/workflow on the accessed entity

πŸ› Bug report
Status

Downport

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom masterperoo

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

Comments & Activities

Production build 0.71.5 2024