Skip to content

Extend :isset element handling in view to support multiple vars #1937

@iamdadmin

Description

@iamdadmin

Description

Would there be any interest in a PR to refactor tempest/view :isset element handling so it can handle complex expressions? The :isset element literally wraps whatever it's given in isset() expecting a true or false

<x-template :isset="$var1" < currently works

<x-template :isset="$var1 || $var2" < currently does not

<x-template :if="isset($var1) || isset($var2)" < what you have to do right now for the equivalent

I therefore propose to extend this so that when multiple $vars are detected, it will wrap each instance of $var and as long as it returns true or false, according to developer needs, it will issue true or false.

It should also support multiple cases, as long as the expression can be written to correctly return a true or false using isset() statements only.

For more complex cases, then :if should still be used.

Benefits

Developer experience and efficiency in code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions