Description
Bug description
I've got a subscriber that extends the blueprint of every entry on EntryBlueprintFound
.
I'm running into a Duplicate field [seo_section_title_description] on blueprint [pages].
This is the same issue I talked about here: #4286. The workaround we came up with comes with its own problems. Which is why I dug a little deeper so I can confidently reproduce the initial issue.
The problem only seems to happen on multi-sites. On multi-sites, the EntryBlueprintFound
event gets triggered for every locale of an entry. So if you add to the blueprint in the event like $event->blueprint->setContents($contents)
, it will throw the exception the second time this method is called.
The simple workaround was to use ensureFieldsInSection()
instead. But the problem with this method is that it ensures all the fields for every locale. This wouldn't be an issue per se, as it clears out duplicate fields when it renders the blueprint. But in my case, it is a problem. That's because I need to add different default
values to the blueprint fields for every locale. And because any duplicate ensured fields get stripped out, I end up with the wrong fields. I hope this makes sense.
How to reproduce
- Create a multi-site and configure a collection to use at least two sites
- Set the blueprint content on
EntryBlueprintFound
- Visit an entry in the CP
- See it throw the duplicate fields error
Logs
No response
Versions
Statamic 3.2.24 Pro
Laravel 8.74.0
PHP 8.0.13
Installation
Fresh statamic/statamic site via CLI
Additional details
No response