webiny / webiny-js

Open-source serverless enterprise CMS. Includes a headless CMS, page builder, form builder, and file manager. Easy to customize and expand. Deploys to AWS.
https://www.webiny.com
Other
7.22k stars 588 forks source link

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

Closed ma-schmidt-de closed 1 month ago

ma-schmidt-de commented 1 month ago

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 commented 1 month ago

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.

Pavel910 commented 1 month ago

@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.

ma-schmidt-de commented 1 month ago

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

Pavel910 commented 1 month ago

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

Pavel910 commented 1 month ago

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