当我们在 Hybris WCMS 页面中已经有 ContentSlot 时,为什么我们有 ContentSlotName?

ash*_*ish 3 hybris

在 hybris 中创建页面时,我们创建 PageTemplate ,然后创建内容槽。每个内容槽都有与之关联的组件。内容槽映射到 PageTemplate。最后我们将 PageTemplate 映射到 ContentPage。这就是在 hybris 中创建 Page 的方式。

由于我们已经有用于工作的页面模板的内容槽,那么为什么我们有 ContentSlotName 以及我们为什么要使用它?

我们可以避免它创建正常的内容页面和电子邮件页面吗?

dj_*_*nza 7

ContentSlotName 用于指示 cmscockpit/smartedit 可以在页面的特定部分添加什么类型的组件。例如:

INSERT_UPDATE ContentSlotName; name[unique = true]; template(uid, $contentCV)[unique = true][default = 'loginPageTemplate']; validComponentTypes(code)
; Login-LeftSection            ; ; CMSImageComponent
Run Code Online (Sandbox Code Playgroud)

Login-LeftSection ”在structure_loginPageTemplate.vm 中定义:

td colspan="6" class="structureViewSection">
  <cockpit code="Login-LeftSection"/>
</td>
Run Code Online (Sandbox Code Playgroud)

当通过位置属性创建关联的ContentSlotForTemplate时,此部分与 ContentSlot(即LoginLeftContentSlot)链接:

INSERT_UPDATE ContentSlotForTemplate; $contentCV[unique = true]; uid[unique = true]; position[unique = true]; pageTemplate(uid, $contentCV)[unique = true][default = 'loginPageTemplate']; contentSlot(uid, $contentCV)[unique = true]; allowOverwrite
; ; LoginLeftContent-loginPageTemplate            ; Login-LeftSection            ; ; LoginLeftContentSlot            ; true
Run Code Online (Sandbox Code Playgroud)

因此,“ Login-LeftSection ”可以在登录页面的 cmscockpit 中可见,如果您尝试在与该部分关联的插槽中添加组件,则只有CMSImageComponent类型的组件可用于添加(因为 ContentSlotName上面定义的实例):

在此处输入图片说明

在此处输入图片说明

因此 ContentSlotName 的目的是限制可以为特定内容槽添加的组件类型。

你的第二个问题的答案是肯定的,我们可以避免它,但这意味着任何类型的组件都可以添加到给定的内容槽中。

更新

上述解释适用于较新版本的 Hybris,其中 cmscockpit 已弃用且使用 smartedit。尽管 smartedit 在不允许将组件添加到某个插槽时具有不同的外观,但 ContentSlotName 的目的保持不变。