[6.x] Fix ensuring config on fields from imported fieldsets - #15187
Open
duncanmcclean wants to merge 1 commit into
Open
[6.x] Fix ensuring config on fields from imported fieldsets#15187duncanmcclean wants to merge 1 commit into
duncanmcclean wants to merge 1 commit into
Conversation
`getTabFields` built its lookup from the raw blueprint contents using
`keyBy('handle')`. An `import:` row has no `handle`, so the fields inside
an imported fieldset were invisible to the lookup, while `hasFieldInTab`
resolves imports and reported them as present. That mismatch made
`ensureFieldHasConfig` throw `Undefined array key`.
It now resolves `import:` rows into their fields and writes the override
into the import's `config` array, keyed by the field's handle within the
fieldset, which is the same shape `ensureField` already produces.
`removeField` no longer errors on an imported field either. It can't be
removed on its own, since the only entry in the contents is the whole
fieldset, so it's left in place.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes an issue where a user without the "edit other authors entries" permission would get an
Undefined array key "author"error when creating or editing an entry, if the blueprint'sauthorfield came from an imported fieldset.This was happening because
getTabFieldsbuilt its lookup from the raw blueprint contents usingkeyBy('handle'). Animport:row has nohandle, so the fields inside an imported fieldset were invisible to the lookup, whilehasFieldInTabresolves imports and reported them as present.ensureFieldHasConfigtrusted the latter, then indexed into the former.This PR fixes it by resolving
import:rows into their fields, and writing the override into the import'sconfigarray, keyed by the field's handle within the fieldset. That's the same shapeensureFieldalready produces for imports.This PR also stops
removeFielderroring on a field from an imported fieldset. It can't be removed on its own, since the only entry in the contents is the whole fieldset, so it's left in place.Fixes #8805
Related: #8803