Skip to content

Added view option to render a view with Yii inside tab content #87

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nilsburg
Copy link

@nilsburg nilsburg commented May 9, 2024

Q A
Is bugfix?
New feature? ✔️
Breaks BC?
Fixed issues

Adds the posibility to render a view inside a Tab content.

echo Tabs::widget([
    'items'   =>[
        [
            'label'   => 'Tab label',
            'view'    => ['@app/views/site/my-view',['param1'=>'value1']],
            'visible' => true,
        ],
    ],
]);

The main benefit is that when used with visible = false it won't render the view.

@simialbi simialbi added question pr:missing usecase It is not clear what is the use case for the pull request. labels Apr 10, 2025
@simialbi
Copy link
Collaborator

is this really necessary? possible to do with

echo Tabs::widget([
    'items'   =>[
        [
            'label'   => 'Tab label',
            'content' => $this->render('@app/views/site/my-view', ['param1'=>'value1']),
            'visible' => true
        ]
    ]
]);

inside view, isn't it?

@simialbi simialbi assigned simialbi and nilsburg and unassigned simialbi Apr 10, 2025
@nilsburg
Copy link
Author

Hi,
the difference is that when using

echo Tabs::widget([
    'items'   =>[
        [
            'label'   => 'Tab label',
            'content' => $this->render('@app/views/site/my-view', ['param1'=>'value1']),
            'visible' => false
        ]
    ]
]);

The view will be rendered, even though visible is set to false.

@simialbi simialbi added severity:minor status:under discussion type:enhancement Enhancement and removed question pr:missing usecase It is not clear what is the use case for the pull request. labels Apr 11, 2025
@simialbi
Copy link
Collaborator

Ok so it would be some performance boots by preventing the rendering inside widget when visible false, correct?

@nilsburg
Copy link
Author

Not only performance, also to avoid code conflicts (some developer might put some JS in the view that overrides the JS in another view)

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

Successfully merging this pull request may close these issues.

3 participants