Entity reference field is return node object in node twig template

Created on 28 May 2024, 7 months ago
Updated 29 May 2024, 7 months ago

Problem/Motivation

Entity reference field is return node object in node twig template

Steps to reproduce

  • I have a taxonomy reference field in article content type
  • Then I have overrided the node template and using below code to get the referenced entity in twig
    {% set term_entity= node.field_taxonomy_ref.entity %}
    

    this term_entity variable hold correct object when there is data in field_taxonomy_ref field

  • But when this field field_taxonomy_ref does not have any data then node.field_taxonomy_ref.entity line returning the node object instead of null

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

💬 Support request
Status

Closed: duplicate

Version

10.2

Component
Entity 

Last updated about 16 hours ago

Created by

🇮🇳India nitesh624 Ranchi, India

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024