Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

这里是基于stkArticle模板的一个新页面上的自动生成组件。

特性组件

特性模板主要由在页面模板的特性模板主要通过页面模板的main/content区域绘制的组件区分开。区域绘制的组件标识。stkImagGallerystkFAQstkSiteMap等组件在stkImageGallerystkFAQstkSiteMap等模板的该区域绘制。组件由页面模板自动绘制,由自动生成特性完成。

组件定义与其他组件使用的配置方法,您可以在特性组件定义与其他组件配置方法相同,您可以在STK > 模板定义 /components/features里查看。

下列所示的stkSiteMap组件:

  • 使用使用了SiteMapParagraphModel,包含了业务逻辑,并使,这个模型类包含业务逻辑,并使maxLevelsshowSiteMapRoottitleToUse属性对脚本可用。
  • siteMap.ftl脚本绘制,该脚本可在脚本绘制。该脚本在STK > 模板 /templating-kit/components/features/siteMap.ftl找到。
Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
节点名

components

 

features

 

stkSiteMap

 

Paragraph

description

paragraphs.features.stkSiteMap.description

Paragraph

dialog

standard-templating-kit:components/features/stkSiteMap

Paragraph

i18nBasename

info.magnolia.module.templatingkit.messages

Paragraph

modelClass

info.magnolia.module.templatingkit.templates.components.SiteMapParagraphModel

Paragraph

renderType

stk

Paragraph

templateScript

/templating-kit/components/features/siteMap.ftl

Paragraph

title

paragraphs.features.stkSiteMap.title

当一个基于stkSiteMap模板的页面被创建时,组件被使用区域定义(见下表)中配置的缺省值绘制。编辑者可以在模板的页面被创建时,组件使用区域定义中配置的缺省值(见下表)绘制。编辑者可以在STK > 对话框定义 /components/features/stkSiteMap下配置的stkSiteMap组件对话框里修改这些缺省值。查看组件对话框里修改这些缺省值。您也可以查看demo-project/service/site-map页了解它是如何工作的。

stkSiteMap页面模板的页面模板里,areas/main/areas/content节点下:节点的:

  • /autoGeneration节点在generatorClass节点的CopyGenerator类里分配。该生成器创建节点和属性,其中属性和链接到类里分配。该生成器创建节点和属性,使他们与templateId属性并且只适用于属性里链接到的且只适用于autoGeneration节点的配置一致。
  • autoGeneration/content/singleton节点里:
    • 缺省值被分配给显示给组件模型的属性。组件模型显示的属性使用缺省值。
    • nodeType被设置为设置为mgnl:component
    • templatedId属性引用stkSiteMap组件定义,使用<module name>:<path to component>结构。
Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
节点名

pages

 

stkSiteMap

 

areas

 

main

 

areas

 

intro

 

content

 

autoGeneration

 

content

 

singleton

 

Paragraph

maxLevels

3

Paragraph

nodeType

mgnl:component

Paragraph

showSiteMapRoot

true

Paragraph

templateId

standard-templating-kit:components/features/stkSiteMap

Paragraph

titleToUse

title

Paragraph

generatorClass

info.magnolia.rendering.generator.CopyGenerator

Paragraph

type

single

Paragraph

class

info.magnolia.module.templatingkit.templates.MainArea

这里是这是stkSiteMap组件和demo-project/service/site-map页面上的对话框。

...

在上面的对话框里,maxLevels属性被设置为4。这是因为模板定义里的缺省值,这是因为模板定义里的缺省值3在此页上已经被覆写了。新值4被存在JCR中,您可以在工具 > JCR /demo-project/service/site-map/content/singleton中验证。

Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
节点名

demo-project

 

service

 

site-map

 

content

 

singleton

 

Paragraph

maxLevels

4

Paragraph

showSiteMapRoot

true

Paragraph

titleToUse

title

如果您想要在模板定义中修改一个自动生成的组件的缺省设置,您需要首先在JCR浏览器中删除这个内容节点(如果您想要在模板定义中修改一个自动生成组件的默认设置,您需要首先在JCR浏览器中删除这个内容节点(singleton)并刷新该页。系统会使用新的模板定义属性在页面上重新创建该组件。这是一个已知问题,您可以在MAGNOLIA-4482里跟踪进展。