Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check existence of multiple blocks with an || condition #345

Closed
mabar opened this issue Aug 13, 2023 · 0 comments
Closed

Check existence of multiple blocks with an || condition #345

mabar opened this issue Aug 13, 2023 · 0 comments

Comments

@mabar
Copy link

mabar commented Aug 13, 2023

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant