Skip to content

Allow rendering of tab content via Closure #172

@SamMousa

Description

@SamMousa

What steps will reproduce the problem?

Use a tab widget, inside use any widget that uses javascript and targets the widgets' id.
Then hide the specific tab that has the javascript widget.

What's expected?

The tab should be hidden, no errors.

What do you get instead?

Errors. Since the tabs does get render, javascript gets registered but the html does not get outputted. This means the JS will not find elements it is expecting.

This is not so much a bug as a limit of the implementation.

My proposal is to allow rendering of tab widgets via a Closure:

echo Tabs::widget([
    'items' => [
        [
            'visible' => false,
            'content' => function() {

            }
    ]
]);

A work around currently is to use an object that implements __toString() and lazily renders the tab only when __toString() gets called.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions