如果我想在页面A中设置可编辑的cq5组件,但在页面B中不可编辑,是否可行。
例如:在页面A,我有C组件,我们允许作者打开对话框并编辑组件。 但我们不允许作者打开对话框来编辑第B页上的组件C.我尝试研究cq:EditConfig 链接 ,但这还不足以解决我的问题。
Is it posible if i want to set a cq5 component editable in page A, but not editable in page B.
For example: at page A, i have C component we allow authors to open dialog and edit the component. But we do not allow authors to open dialog to edit component C on Page B. I try to research cq:EditConfig link, but It's not enough documentation to resolve my issue.
最满意答案
您可以在include之前设置ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE,并在include之后将其删除。
组:
slingRequest.setAttribute(ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE, true);去掉:
slingRequest.removeAttribute(ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE);更多详情请访问: https : //dev.day.com/docs/en/cq/current/developing/boilerplates.html
您可以编写Sling组件过滤器:
您可以检查页面和组件,如果要禁用编辑,只需设置属性,执行过滤器,然后取消设置属性...
You can set ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE before the include, and remove it after the include.
Set:
slingRequest.setAttribute(ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE, true);Remove:
slingRequest.removeAttribute(ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE);More details are here: https://dev.day.com/docs/en/cq/current/developing/boilerplates.html
You can write a Sling component filter:
And you can check the page and the component, and if you want to disable editing, just set the attribute, do the filter, and unset the attribute...
更多推荐
发布评论