I have user created content. I use the content-moderation plugin, so user can update their nodes but the updates will only be published after moderation. I like to display a little batch (has new unpublished update) on the user-nodes, to give the user an information about the moderation state.

For nodes with new revision in draft-state shows drupal a "last-version"-link in node-links-menü. It must be possible to check, if there is a new revision in draft state (in preprocess_node). Who can help me and write a little php code for this check so I can generate a twig_variable "has_draft_state".

Thanks in advance


Maybe this could help you

{% set isNew = node.isNewRevision %}

Otherwise use template_preprocess_node() in your theme to generate needed variable.

| improve this answer | |
  • Thank you, but {% node.isNewRevision %} does nothing. How can I check if node has an unpublished revision in preprocess_node()? – Kay Beißert Apr 18 '18 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.