Incompatibility with Moderation Sidebar module (and possibly others)

Created on 31 March 2025, 14 days ago

Problem/Motivation

Entity Copy Reference creates a fatal error when used simultaneously with the Moderation Sidebar module. The issue is:

Error: Call to a member function access() on null in entity_copy_reference_menu_local_tasks_alter() (line 47 of /mnt/www/html/cmogshop/docroot/modules/contrib/entity_copy_reference/entity_copy_reference.module).

Essentially, the other module is triggering our menu_local_tasks_alter hook, but since it's happening through Ajax, \Drupal::routeMatch()->getParameter('node') is returning NULL.

Steps to reproduce

Install both Entity Copy Reference and Moderation Sidebar, and configure both modules for use on the same content type. When attempting to use the sidebar, you should get an "oops, something went wrong" ajax message on the page, and the above error in the logs.

Proposed resolution

Add a null-safe operator to our conditional on line 47 of entity_copy_reference.module:

if ($node?->access('update') && $entityCopyReference->isCopyEnabled($node)) {

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States rwanth New York, USA

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