outl1ne / nova-settings

A Laravel Nova tool for editing custom settings using native Nova fields.
MIT License
278 stars 97 forks source link

Strange behavior when using custom resource tool #189

Closed aliwesome closed 3 months ago

aliwesome commented 3 months ago

I've made a custom resource tool called Email Preview with component name email-preview, whenever I use it in Nova Settings like this:

NovaSettings::addSettingsFields([
        EmailPreview::make()
]) 

a form- prefix is being added to the component so it cannot be loaded.

Tarpsvo commented 3 months ago

That's how Nova fields work. There's 3 prefixes depending on where the field is being rendered: index- detail- form-

aliwesome commented 3 months ago

@Tarpsvo It's not actually a Nova field, it's a custom resource tool, I used to use it the same way on version 3, but it goes broke on version 4.

How can I handle that? to load a custom resource tool on settings page?

Tarpsvo commented 3 months ago

Nova settings renders only fields, so you need to add a form- prefix. Custom tools usually have their own dedicated page with a separate menu item in the left.