Skip to content

Instantly share code, notes, and snippets.

@isramv
Created February 10, 2023 16:11
Show Gist options
  • Save isramv/21912a814f4438400f8ed7eaded388c4 to your computer and use it in GitHub Desktop.
Save isramv/21912a814f4438400f8ed7eaded388c4 to your computer and use it in GitHub Desktop.
How to check if a multiple paragraph is empty
{% set preprinted_supplies = node.field_issue_calendar.value %}
{% set preprinted_supplies_not_empty = [] %}
{% for item in preprinted_supplies %}
{% set psp = drupal_field('field_preprinted_supplied_pieces', 'paragraph', item.target_id) %}
{% if psp['#title'] is not null %}
{% set preprinted_supplies_not_empty = preprinted_supplies_not_empty|merge(['true']) %}
{% endif %}
{% endfor %}
{% if preprinted_supplies_not_empty|length > 0 %}
<th scope="col">PREPRINTED SUPPLIED PIECES DUE</th>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment