When using the Publish Content module alongside the Moderation Sidebar module, clicking the moderation sidebar button on a node page triggers a fatal 500/AJAX error.
This happens because the moderation sidebar renders the local tasks in an off-canvas dialog under its own route:
`/moderation-sidebar/{entity_type}/{entity}/latest`
On this route, the path parameter is named `{entity}` instead of `{node}`. When the local task manager builds the tasks, `PublishContentLocalTask::getTitle()` executes and attempts to load the node using:
$node = $this->nodeStorage->load($this->routeMatch->getRawParameter('node'));
Steps to reproduce
- Enable the publishcontent and moderation_sidebar modules.
- View a moderated node page and click the "Moderation Sidebar" tab/button.
- The sidebar AJAX request fails with a 500 error due to the AssertionError.
Issue fork publishcontent-3605463
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
prem suthar commentedComment #3
prem suthar commentedComment #4
prem suthar commentedComment #7
gurkawal commentedHi @prem suthar
I have created a merge request for this issue.
The fix adds a safe check before loading the node in PublishContentLocalTask::getTitle(). On the Moderation Sidebar route, the route parameter is {entity} instead of {node}, so the previous code tried to load an empty node ID and caused a 500/AJAX error.
Now, if the node route parameter is missing or the node cannot be loaded, it falls back to the parent title. I also updated getCacheTags() to return the node cache tag only when a valid node parameter exists.
This prevents the fatal error and allows the moderation sidebar to open correctly.
Please review once
Comment #8
gurkawal commentedComment #9
astonvictor commentedI'm ok to merge the current MR to the dev version but not sure if the module works with the workflow module - #3023951: Compatible with content moderation?