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

Can't render Panel inside container #28

Open
noahlocke opened this issue Feb 13, 2020 · 1 comment
Open

Can't render Panel inside container #28

noahlocke opened this issue Feb 13, 2020 · 1 comment

Comments

@noahlocke
Copy link

ConditionalContainer::make(
  new Panel('This is a panel', $this->fields())
)->if('type = 1')

The above will render the fields, but not the Panel.

@likeadeckofcards
Copy link

likeadeckofcards commented Nov 25, 2021

@noahlocke So it looks like the structure or panels and conditional containers are currently not super friendly of one another. It is not necessarily a super pretty workaround but I managed to get the panel to render correctly in the forms by using:

tap(ConditionalContainer::make([
            Panel::make('Panel 2', [
                       Text::make('some field')
            ]),
        ])->hideFromIndex()->if('type = \'true\'), function($container) {
            $container->panel = 'Panel 2';
        });

This forces the conditional Container to use the panel 2 instead of the main panel.

Update: please note that this does not prevent the Panel's title from displaying. It just fixes the contained fields from displaying under the wrong panel. In order to hide the name, the conditional container would have to specifically be able to change the component type of the form-panel. However, Laravel Nova does not not offer the capability to change the component used for a panel.

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

2 participants