Required on Workflow State

Created on 11 October 2018, over 6 years ago
Updated 4 March 2024, over 1 year ago

The new core content moderation module is based on the ols workflow module.

This had a some approaches to require fields dependent on a workflow state:

https://www.drupal.org/project/wf_required_fields β†’
https://www.drupal.org/project/wf_required β†’

It would be great to extend this module that fields can be required on certain moderation states.

This might probably be a submodule.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany demonde

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada mandclu

    +1 for this

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    We have a requirement for this, where we have a "Ready to publish" state, just before publish, and so it would be great to be able to select the transition that the check should be done on.

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    Thinking about this more, I think what would work well is to add a checkbox to the workflow transition form which allows setting whether content should be required on transitioning to this stage, something like:

    Label: Enable require on publish checks for this transition
    Description: When enabled, content passing through this transition will have the require on publish validation performed for any fields which have the "Require on publish" option enabled.

    That then gives us the flexibility to have the check performed at multiple transitions, which I think is more robust.

    For example, enabling this for both "Ready to publish" and "Published" would mean that even if content is edited after it has transitioned to the ready to publish state, the validation should still be performed.

  • πŸ‡ΊπŸ‡ΈUnited States jcandan

    Any chance ✨ Add require on publish as a conditional field option Active fixes this? I haven't tested, but since it adopts #states condition handling, that might address this issue.

  • πŸ‡ΊπŸ‡ΈUnited States jcandan

    Ya know! Actually, I missed this ticket when I created πŸ› Fix Paragraphs support with Content Moderation Active . Please take a moment to review the patch/MR there. Sorry if this ended up being a duplicate ticket!

  • πŸ‡ΊπŸ‡ΈUnited States jcandan

    By the way, just to clarify why I think ✨ Add require on publish as a conditional field option Active may be related is that it introduces state handling for conditions (e.g. when some other field is check, make this one required on publish).

    Though it may seem πŸ› Fix Paragraphs support with Content Moderation Active has more to do with this module's Paragraphs support, it adds support for moderation states that are considered Published.

    I don't think we had this before.

                $workflow = $this->moderationInfo->getWorkflowForEntity($parent);
                $new_state = $workflow?->getTypePlugin()->getState($moderation_state[0]['state']);
                if ($new_state) {
                  $is_published = $new_state->isPublishedState();
                }
    

    I don't think that fully encompasses this issue's desired outcome, but it may be a step in the right direction.

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    ✨ Add require on publish as a conditional field option Active sounds like a really good idea! Maybe we block this issue on that one? Because once that's in then I'm assuming this becomes a lot easier and can then just focus on adding a UI for this common use-case.

  • πŸ‡ΊπŸ‡ΈUnited States jcandan

    Actually, I just thought of a use-case for us where this would come in handy. And, not only does that #states ticket get us part of the way there, πŸ› content_moderation support Needs work introduces content moderation published states as well. And, yes, from there, I agree, some logic and a UI to handle state selection would get us the rest of the way. Looking forward to this.

    Postponed until the above are adopted.

Production build 0.71.5 2024