Is there a way to render a node with view mode via token? Like:

  • Do you mean you want to know the API which can get the output from the token string? I guess you are looking for Token::replace
    – Jimmy Ko
    Commented Jun 8, 2016 at 18:34
  • @JimmyKo na I wanted to know if there was an existing text filter for that token, like insert view and insert block
    – Alex
    Commented Jun 9, 2016 at 8:02
  • Did you try token_filter?
    – Jimmy Ko
    Commented Jun 9, 2016 at 8:17

1 Answer 1


So the question is how to insert something like [node:5:teaser] into a formatted text area and get the teaser view of node 5.

This can be done with a combination of modules:

Token Filter (D7,D8)

Token Filter is a very simple module to make token values available as an input filter.

So (after adding that filter to the text format), for the current node, we can use e.g. [node:title] in formatted text.

Token Entity Render (D7, D8 Issue)

Provides tokens ([entity_type:render:view_mode_name]) that render full entities using view mode specified.

Advanced Entity Tokens (D7, D8 Issue)

Through AET you can query the DB for entities using Tokens. Examples: [aet:node:1]

Putting it together

In the end you should be able to use [aet:node:5:render:teaser] in your formatted text.

  • 1
    I'm amazed this is possible with tokens too, but I'd also suggest to consider the Entity Embed module for a use case like this. I'm using it successfully for media entities.
    – Hudri
    Commented Jun 14, 2019 at 13:42
  • entity_embed - good point. Isn't most of this in media core these days anyway? Commented Jun 16, 2019 at 23:05
  • Advanced Entity Tokens seems like a good idea for textual data, say if I want a specific Term ID for a link based on its UUID. I'll see if I can get a proper D8 version rolling based on the existing patch.
    – colan
    Commented Jul 28, 2020 at 16:32

Your Answer

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

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