Workflow Content moderation condition

Created on 14 August 2023, about 1 year ago
Updated 22 December 2023, 9 months ago

Is it possible to apply a condition to compare a workflow status?

Eg: moderation_state = "published" or "draft"

I'm passing from Rules to ECA and I can't find solution to replicate profile.moderation_state.value selector because content moderation have'nt token.

Thanks guys for your hard work.

💬 Support request
Status

Closed: outdated

Version

1.2

Component

Documentation

Created by

🇮🇹Italy ConradFlashback

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

Comments & Activities

  • Issue created by @ConradFlashback
  • 🇩🇪Germany jurgenhaas Gottmadingen

    You can do that by comparing scalar values. Just compare the [entity:moderation_state:value] token to the string you're interested in, i.e. published or draft.

  • 🇮🇹Italy ConradFlashback

    Thanks for your answer. I don't understand where I'm wrong.
    It's a very simple rule :O

    Screeen 1: the condition doesn't work

    Screen 2: [profile:moderation_state:value] token is not recognized in message

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I can't read the labels in your screenshots, I don't speak that language. Please use English, so that everyone can participate.

    The token named profile may not be available in that context. Have you checked the debugging techniques described in the ECA Guide? If so, what's the output for the condition, i.e. what tokens are available at that time and what are their values?

  • 🇮🇹Italy ConradFlashback

    Sorry jurgenhaas, the only label not in english is my profile type name from entity profile module:
    https://www.drupal.org/project/profile

    Log:
    Unconditional Token message: [profile:moderation_state:value] (Activity_0kdue9s) from ECA Rule example Profile update (process_obmxn68) for event Drupal\eca_content\Event\ContentEntityUpdate.

    Not asserting condition Flow_0k5i15w for noname from ECA Rule example Profile update (process_obmxn68) for event Drupal\eca_content\Event\ContentEntityUpdate.

    Content moderation maybe have not token for this, not only for profile entity.
    https://www.drupal.org/project/drupal/issues/3225851 Add tokens for content moderation state Needs work
    In the token list I can't see [entity:moderation_state]

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Have you had a chance to look into the token documentation at https://ecaguide.org/eca/concepts/tokens/ ?

    It explains how token names relate to the tokens in the token browser. And the debugging is showing a list of tokens with their names and types, that are available at each individual step during processing. It would greatly help to review and copy that information here as well, so that we can point you in the right direction.

  • 🇮🇹Italy ConradFlashback

    Thanks Jurgen,
    moderation status does not have a token.
    https://www.drupal.org/project/drupal/issues/3225851 Add tokens for content moderation state Needs work
    It's not possible for me to create a condition with ECA because of this.

    The only (and good) solution is to use differents workflow status events rather than conditions.
    I only found out about this great event today :(

    Thanks to all!!

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Fair enough, but you could use the field value comparison instead, that's what we're using in some projects:

  • Status changed to RTBC about 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    @ConradFlashback has this issue been resolved or is there any outstanding topic that needs to be addressed?

  • Status changed to Postponed: needs info about 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Corrected the issue status.

  • Status changed to Closed: outdated 9 months ago
  • 🇩🇪Germany jurgenhaas Gottmadingen
Production build 0.71.5 2024