-
Notifications
You must be signed in to change notification settings - Fork 15
fix: clone fields not respecting prefix #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
This reverts commit 3a22eba.
…ypes should inherit which Interfaces to the clone field type - @todo remove some debug code and test further
- add missing translators comment - remove some debug code - move logic for clone field interfaces out of the Registry and into the CloneField.php - modify logic for how flex field layouts are mapped to the schema
3 tasks
- update logic for how clone fields are mapped to the schema when individual fields are cloned and when entire field groups are cloned - update AdminSettingsCest to account for multiple field groups existing at the same time
… within a flex layout - remove commented out code from CloneField.php - modify tests to account for multiple field groups being imported in the test suite - update test to account for flex field layout type name change
Pull Request Test Coverage Report for Build e92b625fbee198f62089d7a64d18e33e3fead666-PR-136
💛 - Coveralls |
… of returning the resulting type
…efined before looping over them - update Repeater to return early if cloned
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.
What does this implement/fix? Explain your changes.
This fixes a bug where multiple clone fields using the "prefix_name" setting weren't being added to the Schema properly or resolving properly.
Does this close any currently open issues?
Closes #125
Any relevant logs, error output, GraphiQL screenshots, etc?
Given the following ACF Field Group export:
acf-export-2023-12-07.json.zip
And a page with the following content entered using these fields:
BEFORE
Inspecting the
CustomContentType in the Schema shows that it has 3 fields:String[ContentSectionsSections_Layout]StringThe following query can be executed successfully:
However, this is only returning the "Content" field that cloned "All fields from the Content Sections" field group.
The "Sidebar" field that also cloned "All fields from the Content Sections" field group is unable to be queried. 😢
AFTER
Now, we can execute the following query to get both the "Content" sections that were cloned with no prefix, AND we can query the "Sidebar" sections which cloned with "prefix_name" true.
And this yields the following results:
{ "data": { "page": { "id": "cG9zdDoxMg==", "title": "Custom Content", "customContent": { "sections": [ { "__typename": "ContentSectionsSectionsHeroLayout", "text": "content hero text", "image": { "node": { "sourceUrl": "http://acf-clone-debug.local/wp-content/uploads/2023/12/profile.jpeg" } } }, { "__typename": "ContentSectionsSectionsHeroWithCtaButtonLayout", "text": "Hero with CTA Text", "image": { "node": { "sourceUrl": "http://acf-clone-debug.local/wp-content/uploads/2023/12/categories-mutation-update-not-allowed.png" } } } ], "sidebar": { "sections": [ { "__typename": "ContentSectionsSectionsHeroLayout", "text": "sidebar hero text", "image": { "node": { "sourceUrl": "http://acf-clone-debug.local/wp-content/uploads/2023/12/application-data-graph.png" } } } ] } } } } }Any other comments?
This is a possible breaking change for users that were using clone fields and/or flexible content fields.
It's highly recommended that you test your queries on a staging environment and modify as needed.