Skip to content

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

@mabar

Description

@mabar

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}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions