Drupal 8/9 verify a field is not empty in the twig template

The built-in method isEmpty can be used to determine if a field is empty (). This code snippet works for all field types, checking if the field exists and if the field is not empty. For example, field_name is a field machine name of content.



Read Next