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

πŸ§‘β€πŸ’» Add support for custom menu and menu item fields #6

Merged
merged 5 commits into from
Aug 8, 2024
Merged

πŸ§‘β€πŸ’» Add support for custom menu and menu item fields #6

merged 5 commits into from
Aug 8, 2024

Conversation

Log1x
Copy link
Contributor

@Log1x Log1x commented Aug 8, 2024

This adds basic support for adding extra menu and menu item fields to the forms. Right now it would require you make your own migration adding the columns but another option would be to ship the plugin with a JSON column called data (for example) and adding ->statePath('data') to the Group::make()'s.

use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin;

FilamentMenuBuilderPlugin::make()
    ->addMenuFields([
        Toggle::make('is_logged_in')
            ->hint('Only show this menu item when the user is logged in.'),
    ])
    ->addMenuItemFields([
        TextInput::make('classes'),
    ]);

@datlechin datlechin self-requested a review August 8, 2024 14:19
@datlechin
Copy link
Owner

I think it's better to update the published migration or create a new migration to add the corresponding column for the custom field rather than storing the custom field in a JSON format.

And could you kindly update the README to include this?

Thank you for the PR.

Copy link
Owner

@datlechin datlechin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@datlechin datlechin merged commit 36dbf8d into datlechin:main Aug 8, 2024
1 check passed
@Log1x Log1x deleted the feat/custom-fields branch August 8, 2024 14:58
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

Successfully merging this pull request may close these issues.

2 participants