Unlock selected fields of component in structure mode of editable template
Hello,
After a component is added and unlocked in the structure mode of an editable template, the whole component i.e every field of the component is available for edit in page authoring mode.
I have a requirement where, when I unlock a component, I want only the selected fields of the component to be available for edit in page authoring mode.
Say, for example, Text core component has following fields:
- text
- id
In structure mode after I add a Text component to my template, I want to author just the 'id' field and leave the 'text' field open for edit in the page authoring stage.
So the behavior after unlocking should be -
a) Only 'text' field be available for the normal authors to edit at page authoring level and not the 'id' field.
b) But the value of 'id' element gets copied to the page instance level.
The solution that I used to achieve this behavior is -
a) In the template, after authoring 'id' field, I'm disabling it using a policy (so that it is not available at the page level) and then unlocked the component. For disabling I'm using
granite:hide="${cqDesign.disableId}"
b) I'm reading the value of 'id' field from under the initial content of the template (as the resource name is similar)
Is there a better/elegant and fault-tolerant way to achieve this behavior?
Thanks
Ved