nette/latte

Check existence of multiple blocks with an || condition

mabar opened this issue · 0 comments

mabar commented

Currently an only convenient way to check existence of at least one of many blocks is to use $this->hasBlock(), e.g. {if $this->hasBlock('title') || $this->hasBlock('action-buttons') || $this->hasBlock('breadcrumb')}
But $this can't be used in combination with strict parsing introduced in https://github.com/nette/latte/releases/tag/v3.0.8-RC1

I would like if Latte had e.g. a function for that so I could write {if hasBlock('title') || hasBlock('action-buttons') || hasBlock('breadcrumb')}
It would also allow more explicit {if hasBlock('foo') && hasBlock('bar')} instead of current {ifset block foo, bar}
And unlike {ifset} it can be easily combined with other conditions like {var $hasActionsColumn = hasBlock('row-actions') || $hasFilter}