Is it possible to create a Filament settings page with a tabbed form, for multiple settings groups?
I have created a few Filament Spatie Settings pages, but I feel like this quickly gets overwhelming with more and more settings pages.
So I was wondering how to create a settings page, that contains a tabbed view of all settings groups, where each tab would be a form for that specific settings group?
Solution:Jump to solution
Thanks! I managed to do it, but I still copied the blade view that the SettingsPage uses, and used it for my
ManageSettings
page.
I tried to get the submit button to be tab specific, but gave up on this in the end, and just checked if the submitted settings have changed, and then only save the changed settings to the database to keep timestamp integrity.
To keep adding and removing settings classes to and from tabs simple, I added an interface for my settings classes, and added tab name, schema, and tab order parameters directly to the settings classes to be used by the filament tabbed settings page. Then the settings page looks through all classes that implements the interface, and builds the tabs dynamically from these....10 Replies
Hi there, I think this would be possible but you have to "lend" some code from use Filament\Pages\SettingsPage to get it to work
Hi! Do you mean I would have to create my own Page without extending the SettingsPage?
Yes indeed... then take some code from the base Settingspage to fit your needs
Use your own fillForm to fill your tabbed form with all the settings
and save() to write them back to the database π
I will give it a go, thanks!
You're welcome... you can do it π
Would I have to write my own blade view as well?
no that's not necessary
check out https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#using-multiple-forms to see the use of statePath for storing the different settings in seperate arrays
Solution
Thanks! I managed to do it, but I still copied the blade view that the SettingsPage uses, and used it for my
ManageSettings
page.
I tried to get the submit button to be tab specific, but gave up on this in the end, and just checked if the submitted settings have changed, and then only save the changed settings to the database to keep timestamp integrity.
To keep adding and removing settings classes to and from tabs simple, I added an interface for my settings classes, and added tab name, schema, and tab order parameters directly to the settings classes to be used by the filament tabbed settings page. Then the settings page looks through all classes that implements the interface, and builds the tabs dynamically from these.
app/Settings/Contracts/SettingsTabInterface.php
:
an example app/Settings/GeneralSettings.php
And my Filament settings page app/Filament/Pages/ManageSettings.php
in next messageapp/Filament/Pages/ManageSettings.php