Closed pxpm closed 1 month ago
Can you provide where are you setting those configurations ? It should be in config/backpack/theme-tabler.php
Can you make sure you don't have the configs cached ? You can try an php artisan optimize:clear
to bust the caches.
Cheers
yup, that's the config file, I tried also that command, it doesn't do what we would expect. As a hack I did this in order to set the layout I want
routes/backpack/custom.php
Route::get('/', function (Request $request) {
Session::put('backpack.theme-tabler.layout', $request->get('layout', 'vertical_transparent'));
return Redirect::to('/admin/dashboard');
});
Did you started you project from the demo ?
Switching themes/layouts is something we built in demo to show-off the different options.
The only thing built in tabler theme is the color mode (light/dark), all the rest are demo specific files. Eg: https://github.com/Laravel-Backpack/demo/blob/main/resources/views/vendor/backpack/theme_switch_modal_bs5.blade.php
In any case I don't think your code is doing what's expected. ->get('layout', 'vertical_transparent')
would only use vertical_transparent
if there is no layout
in the request. If there is, say horizontal
, it would use the horizontal one.
I have the pro version. I tried to change the layout again with "vertical" and worked. Totally agree with what you're saying and I'm not saying that is the desired fix for this issue, probably the issue lies elsewhere, don't have too much time to investigate this at the moment.
What I meant is that it's not part of our packages.
This theme switcher only exists in demo. And 100% you shouldn't start your project from demo. https://github.com/Laravel-Backpack/demo/blob/main/app/Http/Middleware/Theme.php This is the middleware in demo that allows to change the theme.
If I am not getting the issue, can you post a screenshot or something to help me ?
Cheers
I can see this menu on top, where I can choose the layout. I was asking if there's a way you could switch that off via config and select a default layout instead.
The case I'm dealing with right now is that some users may have the horizontal layout selected already and I want to switch that to vertical layout without them to do anything.
I have joined a project so I don't know exactly if it was started as a demo or not, how can I see that in git?
Indeed @dtmirror there is no config to turn that off, as that was deliberately put/copy into there by whoever created that project.
You can remove it by removing the middleware I told you in your application (it could have a different name, but should be doing the same thing).
And remove the inclusion of that in bit in your UI, most probably in resources/views/vendor/backpack/theme-tabler/inc/topbar_right_content.blade.php
There is also possibly a route where that form submits, most likely in routes/backpack/custom.php
similar to https://github.com/Laravel-Backpack/demo/blob/4941b6b8ca0c928b614f828f3e7685d78fcf316a/routes/backpack/custom.php#L43
There is no 100% way to know if that project started from demo, maybe checking the first ever commit, and if they "cleaned up" demo stuff after.
It's also possible that who created it just copied our implementation from demo (and that's totally fine), so if you don't want to completely remove it like I suggested, you can create yourself a config in your project to enable/disable it.
Hope it helps.
Cheers
thank you for your time @pxpm ! cheers!
Is there a way to get rid of the switching theme option completely? I set this 'showColorModeSwitcher' => false, 'layout' => 'vertical_transparent',
but the theme still shows the header on top. TIA!
Originally posted by @dtmirror in https://github.com/Laravel-Backpack/CRUD/issues/5164#issuecomment-2076681332