Skip to content
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

Fix error when updating Bard configs inside fieldsets #22

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Oct 31, 2024

This pull request attempts to fix an issue when imporing Bard fields where you'd get an error if the Bard field is imported from a fieldset, rather than being directly on the blueprint.

Whenever you import Bard fields, it'll enable nearly all of the available buttons in the toolbar (and create sets for blocks, if you're importing from WP's Gutenberg editor).

Since Statamic's Blueprint::ensureFieldHasConfig() method doesn't support ensuring imported fields, we have to manually find/update the fieldsets.

Fixes #17.
Requires statamic/cms#11096.
Requires statamic/cms#11097.

To Do

  • Add tests to cover importing single fields
  • Consider extracting the "update field config" logic out of the BardTransformer/Gutenberg classes
  • Gutenberg: Fix issue where only one set is added on each "run" of the importer
    • The blueprint/fieldset instance is probably out-of-date, so it only adds the last set. Maybe?
  • Refactor fieldset field ensuring to use the methods added in [5.x] Allow ensuring fields in fieldsets cms#11097
  • Set minimum version constraint of statamic/cms

@duncanmcclean duncanmcclean force-pushed the fix/updating-bard-configs-in-fieldsets branch from 713c00c to 479077b Compare November 12, 2024 15:46
@duncanmcclean
Copy link
Member Author

duncanmcclean commented Nov 12, 2024

We're going to have failing tests in this PR until both statamic/cms#11096 and statamic/cms#11097 have been merged & tagged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when importing Bard field in imported fieldset
1 participant