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.29k stars 601 forks source link

fix(app-headless-cms): add dz template provider #4056

Closed Pavel910 closed 5 months ago

Pavel910 commented 5 months ago

Changes

This PR adds a DZ Template provider to dynamic zone renderer, which helps customize rendering of individual fields based on the parent template. In the field renderers, or FieldElement decorators, you can now use a useTemplate() hook to check whether the field is rendered within a template. The hook is located at ContentEntryEditorConfig.FieldRenderers.DynamicZone.Template.useTemplate.

How Has This Been Tested?

Manually.

Documentation

This will be added to the docs about conditional field rendering.