- Issue created by @msn5158
- 🇷🇺Russia Chi
Loading entities from routes has been removed from this module in 3.x branch. In general, Twig code should not be aware about routes.
As of caching issues, you may add cache contexts in preprocess hook or directly in Twig template. Something like this.
{{ {'#cache': {contexts: ['route']}} }}
See #2660002: Allow explicit bubbling of cacheability metadata inside Twig template (when accessing data from instead of rendering render arrays) → for details.
Hello,
I found in this module ( markup_twig → ) can use twig_tweak to get entity field data, But, in my tests have not print anything, e.g.
{{ node.title }} {{ node.field_tags}}
, is this went wrong by me? do i need to do something? Or has been deleted this function?If I want to get the field data of the parent field by entity reference, what should i do? e.g.
{{ node.field_parent.0.entity.field_parent.0.entity.title }}
Thank you!
- 🇷🇺Russia Chi
By default the node variable is only available on node pages in node.html.twig and page.html.twig templates. For other templates you need to provide it manually via preprocess hook.
- Status changed to Fixed
almost 2 years ago 9:34am 12 April 2023