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

[Feature Request]: Dynamic View Click Through #1083

Open
browner12 opened this issue Oct 9, 2024 · 1 comment
Open

[Feature Request]: Dynamic View Click Through #1083

browner12 opened this issue Oct 9, 2024 · 1 comment

Comments

@browner12
Copy link

Feature Description

Sometimes I'll have a component that supports different "skins", which just means that we conditionally load a view. By passing a variable to the view($pathToFile) method we lose the ability to click through to the view.

It would be amazing if the plugin could analyze the variable, and provide a drop down of any static options (like it does for other features) to allow us to select. I realize it would be impossible to handle any non-static values, and those could be ignored.

$viewPath = match ($skin) {
    'baja-blast' => 'customs.baja-blast',
    'code-red'   => 'customs.code-red',
    'non-static' => 'customs.wont-work-' . rand(1, 10),  //this one would not work
    default      => 'default.path',
};


return view($viewPath);
@adelf
Copy link
Member

adelf commented Oct 18, 2024

I can try to make this working.

return view(match ($skin) {
    'baja-blast' => 'customs.baja-blast',
    'code-red'   => 'customs.code-red',
    'non-static' => 'customs.wont-work-' . rand(1, 10),  //this one would not work
    default      => 'default.path',
});

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

No branches or pull requests

2 participants