Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
Twig provides a test to check if a variable is empty (http://twig.sensiolabs.org/doc/tests/empty.html).
This test fails on Drupal 8 fields.
I came across this issue, as I tried to build a complex layout with Drupal 8 beta 4
Steps to reproduce
- Create a new content type with a text field ›text‹.
- Create a new theme.
- Copy the node templare from core. (core/modules/node/templates/node.html.twig)
- Activate the theme.
- Create a new node of the new content type and enter nothing in the text field.
- Modify the template and use the fields directly.
- Try to test for emptiness.
Comments
Comment #1
idebr CreditAttribution: idebr commentedI believe this is covered in the issue #953034: [meta] Themes improperly check renderable arrays when determining visibility
Comment #2
derheap CreditAttribution: derheap commentedComment #3
lauriii#953034: [meta] Themes improperly check renderable arrays when determining visibility