outl1ne / nova-page-manager

Static page and region manager for Laravel Nova - designed for headless CMS's.
MIT License
180 stars 39 forks source link

Nova 3 style Panel behaviour with override option #135

Closed matthewjumpsoffbuildings closed 2 years ago

matthewjumpsoffbuildings commented 2 years ago

Revert to the Nova 3 style behaviour of storing/retrieving Panel data, using sanitized Str::slug('_') versions of the Panel name by default, but still allow for setting a fieldPrefix override if needed

Fixes https://github.com/outl1ne/nova-page-manager/issues/134

KasparRosin commented 2 years ago

The panel names can be translatable, which means that the data structure can change based on what language the user is using.

matthewjumpsoffbuildings commented 2 years ago

Yes, and this PR allows users who need to, to continue to use the existing:

Panel::make('Translateable Name', [...])->fieldPrefix('something_else')

which they should be using anyway right?

The only change is if they dont specify ->fieldPrefix(), it will default to a slug/snake case of the Panel's name, which for many use cases, this is entirely expected and desirable

Nothing is lost, non-English users still have to use ->fieldPrefix() as they did before, but a new sensible default is added

KasparRosin commented 2 years ago

This would be breaking for all existing nova-page-manager users, who do not use fieldPrefix and don't want panel data in a nested structure.