- Issue created by @nitesh624
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
That's how twig works , entity will call getEntity
You should do this in preprocessing instead
- Status changed to Closed: duplicate
over 1 year ago 11:20am 29 May 2024
Entity reference field is return node object in node twig template
{% set term_entity= node.field_taxonomy_ref.entity %}
this term_entity variable hold correct object when there is data in field_taxonomy_ref field
field_taxonomy_ref does not have any data then node.field_taxonomy_ref.entity line returning the node object instead of nullThat's how twig works , entity will call getEntity
You should do this in preprocessing instead