Twig filter Function is getting different entity object instead of null

Created on 21 May 2024, 4 months ago
Updated 29 May 2024, 3 months ago

Problem/Motivation

In custom twig filter function I am getting node object instead of null

Steps to reproduce

  • Create a custom twig filter say "media_is_image" for media entity object to check type of media.
  • In a article content type add a media reference field.
  • Override the node template in custom theme and add custom filter like below:
    {% set media_item = node.field_media.entity %}
    {% if media_item|media_is_image %}
    -----
    ----
    {% endif %}
  • Now if media field is empty then in the function parameter of twig filter I am getting node object instead of null.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

💬 Support request
Status

Closed: works as designed

Version

10.2 ✨

Component
Theme  →

Last updated 1 day 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