问题描述
有什么方法可以使SmartEdit的“子组件”中的“ OOTB组件”字段为可选?
例如,我通过创建子组件来扩展 CMSParagraphComponent 。 MyCustomParagraphComponent ,它扩展了CMSParagraphComponent。
OOTB CMSParagraphComponent->内容属性是其CMS结构API中定义的必填项
<bean class="de.hybris.platform.cmsfacades.types.service.impl.DefaultComponentTypeAttributeStructure" p:typecode="CMSParagraphComponent" p:qualifier="content">
<property name="populators">
<set>
<ref bean="richTextComponentTypeAttributePopulator" />
<ref bean="requiredComponentTypeAttributePopulator" />
</set>
</property>
</bean>
requiredComponentTypeAttributePopulator 使该属性为强制性。另外,OOTB SmartEdit也使用cmsParagraphComponentValidator进行后端验证。
现在,我要使自定义MyCustomParagraphComponent的content属性为可选
我尝试使用required = false创建新的填充器bean unrequiredComponentTypeAttributePopulator并将其分配给自定义组件的content属性,但这不起作用
尝试这样的事情...
<bean id="unrequiredComponentTypeAttributePopulator" class="de.hybris.platform.cmsfacades.types.populator.requiredComponentTypeAttributePopulator">
<property name="required" value="false" />
</bean>
<bean class="de.hybris.platform.cmsfacades.types.service.impl.DefaultComponentTypeAttributeStructure" p:typecode="PromotionalBannerComponent" p:qualifier="content">
<property name="populators">
<set>
<ref bean="unrequiredComponentTypeAttributePopulator" />
</set>
</property>
</bean>
但这不起作用。看起来CMS Structure API仅适用于直接分配给该组件而不是父组件的那些属性。
那正确的方法是什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)