- 🇭🇷Croatia Aporie
I came along the same issue, and it's not just when trying to use mass_update of nodes from the admin action under /admin/content. It's a global core issue which doesn't take into account moderation state when trying to perform the "unpublish" action.
By default, the
$node->setUnpublish()
only set node status to FALSE which is prevented by content moderation which requires$node->set('moderation_status', 'whatever_is_your_status')
. And the trouble starts here, knowing that you can customize all workflows and states, identifying the one which will archive (unpublish) the node ... it might require a bit of digging around to fix this.Just brainstorming a possible approach, everywhere an action to unpublish a node is taken we should check for:
- if content_moderation is activated.
- identify which state is used for unpublishing (if there is one).
- check for user access against this transition
- if all green:$node->setUnpublish(); $node->set('moderation_state', UNPUBLISH_STATE); $node->save();
It's just a wild guess I didn't have the time to investigate more. On my side I overtook the cancelComfirm function on a custom route and perform user_cancel($edit, $user->id(), 'user_cancel_block'); + my custom batch implementations (which take care of content_moderation integration).
- Status changed to Closed: duplicate
about 1 month ago 7:08pm 12 November 2024 - 🇷🇴Romania amateescu
Closing as a duplicate of 📌 Dynamically provide action plugins for every moderation state change Needs work .