Good morning,
I’ve got a blocks field and want to know, if at least one of the fields has some content.
The docs say:
$blocks->isEmpty();
Checks if the number of elements is zero
So if my client adds some fields that are not required and doesn’t type / fill anything,
would the following be the fastest way to check, if there’s content at all, or is there a “smarter” way / builtin kirby method to check that?
$hasContent = $blocksField->toBlocks()
->filter(fn($block) => $block->content()->text()->isNotEmpty())
->count() > 0;