Skip to content Skip to footer navigation

Is Empty Modifier

Checks an array recursively. It returns true for empty arrays and arrays containing only empty strings or other empty arrays. Values such as null, false, and 0 count as non-empty for this modifier.

some_data:
- is living here
more_data:
with: ''
hopes: ''
and: ''
dreams:
- ''
{{ if some_data | is_empty }}
{{ if more_data | is_empty }}
@if (Statamic::modify($some_data)->isEmpty()->fetch()) ... @endif
@if (Statamic::modify($more_data)->isEmpty()->fetch()) ... @endif
false
true