Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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