I inherited the site I'm working on. We are using the Content Moderation module and running Drupal 10. Looking to allow administrators to 'unpublish' certain on-page content types by adding them to the 'Editorial' workflow. The changes seem to work fine and we're able to unpublish these items per normal. But when added to a page as a module, the content in question continues to appear.

I'm looking to update the paragraph twig to run a check against whether the content type is 'published' or 'unpublished' as those are the only two options in our system. I'm using code that looks like this but I'm obviously doing something wrong as all content types added to a page are being hidden, regardless of whether un/published or not.

{% if moderation_state[0][state] == 'published' %}

Any insight is appreciated.

  • Tag this question with the Drupal major version, like "7" or "10". Provide a link to the contributed module you are using.
    – cilefen
    Feb 8 at 21:40
  • Ordinary programming debugging is in play here. I suppose you need help with that. Have you dumped moderation_state[0][state] to examine the values?
    – cilefen
    Feb 9 at 12:11
  • A dump is returning null values so that would explain why it's not working. I only pulled that code from a Drupal message board in the hopes it would work and probably shouldn't have included it in my original question. I should have asked how could I check to see if content is published or not programmatically since the default behavior isn't taking that into play.
    – iowebmstr
    Feb 9 at 22:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.