0

I am using the Content Moderation and the Workflows modules along with the Workbench Email module to generate email templates. The Workbench Email module uses tokens to create dynamic email templates. We have a requirement to provide the URL of the latest revision inside the email body to the reviewer, to make accessing the latest revision easier.

If I create a node that needs moderation, the /node/NID/latest page doesn't exist; the reviewers will need a link to /node/NID. When the content is already published and gets edited, the link in the email should be /node/NID/latest. If we just provide /node/NID in the URL, it won't show the the latest revision.

Since we can have only one template to handle both of the above conditions, I was looking for a token which could provide me either /node/NID or /node/NID/latest based on whether the content is new or already published.

How can I achieve this?

I am using Drupal 9.1.5.

0

The token needs to be available in the email? I've not created custom tokens in D8 yet but in d7 We'd make a custom token and the value would be set in the token definition based on condition.

1
  • Yes, the token needs to be available in the email body template. I was also thinking to create a custom token but wanted to check if there is any other way out.
    – HarshB
    Mar 19 at 9:52
0

This worked for me: [node:url:unaliased]/revisions/[node:vid]/view

2
  • What happens with that token when /node/1/revisions/1/view doesn't exist or isn't accessible to the user getting the email?
    – apaderno
    Sep 8 at 10:47
  • User is shown the usual node URL. Not sure of the specifics behind it but it works for both scenarios specified in the post. Sep 9 at 11:13

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.