- π¨π¦Canada liquidcms
I also want to hide/disable the moderation state field on the edit form as i only want editors to access state changes through the moderation control block.
setting either:
$form["moderation_state"]["widget"][0]["state"]['#disabled'] = true;
or
$form["moderation_state"]["widget"][0]["state"]['#access'] = true;attempts to leave the Published state as Published even though workflow want to force it to Draft. And in the case of #disabled, where i can still see the selection, it is selecting Draft but in all cases i get error saying Live to Live is not a valid transition (which it isn't).
I would think either hidden or disabled should still allow workflow default transitions to occur.
Hi,
If we update the hidden or disable the moderation state field in the content form. If user want to change the state from one state to another state is not possible for the editor.Hi
I tried the following methods to check whether the permission for the content moderation in editorial user.1. Created a new service for checking the permission with the user that the access or moderation field is disabled or not in the condition.
2. In the validator check that the user has the permission and the content moderation state is disabled for the user or not.
3. In the validator itself check that user workflow moderation content state for permission is allowed or not.This is the Code is already checking the permission. Even the conditon for checking permission also working properly but addviolation constraint message is not coming.
if (!$this->stateTransitionValidation->isTransitionValid($workflow, $original_state, $new_state, $this->currentUser, $entity)) { $this->context->addViolation($constraint->invalidTransitionAccess, [ '%original_state' => $original_state->label(), '%new_state' => $new_state->label(), ]); }
Please let me know incase if I miss anything or Can suggest any new methods to fix the issue.