-
-
Notifications
You must be signed in to change notification settings - Fork 584
Description
Bug description
Hello again.
Another issue I have noticed when experimenting with custom configuration in forms is that if I change user's preferred locale in profile settings then my appended fields override default fields in this section.
In my case I tried appending custom configuration to the existing Fields
section. I do this in my AppServiceProvider like this:
public function boot(): void
{
\Statamic\Facades\Form::appendConfigFields('*', 'Fields', ....);
}
But then I accidentally noticed that if I change my user's locale my custom appended fields replace default configuration fields (Blueprint, Honeypot etc) instead of being appended to them.
Saving the form does not work too.
Using __
or Statamic::trans()
on the 'Fields' string does not help.
How to reproduce
- Install Statamic.
- Append custom fields to existing form section via \Statamic\Facades\Form::appendConfigFields('*', 'Fields', ...) in AppServiceProvider::boot() method.
- Go to profile preferences and change locale to something different.
- Create a form, go to edit form page and see the section fields being replaced instead of appended to.
Logs
Environment
Environment
Application Name: Statamic
Laravel Version: 11.44.2
PHP Version: 8.3.7
Composer Version: 2.5.3
Environment: local
Debug Mode: ENABLED
URL: 127.0.0.1
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 1
Sites: 2 (NL, EN)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.51.0 PRO
Statamic Addons
aryehraber/statamic-captcha: 1.14.0
Installation
Fresh statamic/statamic site via CLI
Additional details
Maybe I am doing it wrong, this seems to be undocumented feature or at least I couldn't find any docs. But from my experience, AppServiceProvider is the right place to do this kind of stuff.