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

feat(app-headless-cms): add object and DZ renderer settings #4155

Conversation

ma-schmidt-de
Copy link
Contributor

Changes

Okay, this is the 2nd iteration of the new feature to expand object and dynamic zone HCMS fields by default. According to @Pavel910's recommendation, I'm using the new renderer settings feature to define an open attribute. If this attribute is set to true, the accordion of the object or dynamic zone field is expanded.

BREAKING CHANGE: none
Closes: #4109

How Has This Been Tested?

Manually, with an in-code content model.
Screenshot 2024-06-05 at 20 16 10

Documentation

We could use this implementation as an example for the section that describes the renderer settings feature.

@ma-schmidt-de
Copy link
Contributor Author

Testing the no-code content model editor, I saw that my implementation acts as expected. The switch is rendered and a settings object is added to the field's renderer.
Screenshot 2024-06-05 at 20 22 53

Yet, saving the model the CmsUpdateContentModel mutation fails due to the fact, that the default fields Title, Description and Image don't have a settings object attached to their field renderer. Is this a known issue? 🤔
Screenshot 2024-06-05 at 20 25 01

When I create an empty content model and add an object, dynamic zone or arbitrary field it works just fine.

Copy link
Collaborator

@Pavel910 Pavel910 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one little change here and we're good to go.

On the topic of mutation error, the settings should be either undefined, or an object. I will have a look at this right there in your PR, and will push a fix for this, so we expedite merging of this PR.

Thank you!

@Pavel910
Copy link
Collaborator

Pavel910 commented Jun 6, 2024

@ma-schmidt-de I pushed a fix for that issue with existing fields, so settings will always fall back to {} if they don't exist on the field.

Matthias Schmidt added 2 commits June 6, 2024 11:59
@ma-schmidt-de
Copy link
Contributor Author

@Pavel910 thanks for adding the fix! I polished the code style according to your feedback.
This looks complete to me now. 👍

@Pavel910
Copy link
Collaborator

Pavel910 commented Jun 6, 2024

It's approved, let's wait for CI to finish, and we'll merge it then.

@Pavel910 Pavel910 changed the title feat: expand object & DZ fields via renderer settings feat(app-headless-cms): add object and DZ renderer settings Jun 6, 2024
@Pavel910 Pavel910 added this to the 5.40.0 milestone Jun 6, 2024
@Pavel910 Pavel910 merged commit fae4b6b into webiny:next Jun 6, 2024
59 checks passed
@Pavel910
Copy link
Collaborator

Pavel910 commented Jun 6, 2024

Thanks @ma-schmidt-de for your contribution! Looking forward to more of these!! 🚀

@ma-schmidt-de ma-schmidt-de deleted the feature/4109-add-open-config-to-dz-and-object branch June 6, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HCMS: Configure Dynamic Zone and Object field to be expanded by default
2 participants