定制现有的应用比从头开发应用要容易、省时。其次的好处是,现有应用的配置会随着Magnolia CMS的新版本而频繁更新。当您扩展配置时,新的随Magnolia版本安装的配置不会改写您的配置,而它们带来的好处还会自动对您可用。另外,Magnolia代码是开源的。因为您可以定制任何东西,您也可以以使应用难以更新的方式定制。以下为一些正确定制的指南。
Tip |
---|
扩展,而不要拷贝。直接将您的个性化配置添加到原有的应用配置里,或者采用更好的方法——扩展原有的配置。 |
添加定制动作
将您自己的定制动作添加到现有应用中。例如,添加一个直接发布的动作,绕开审批的工作流程。动作是在子应用下配置的。这里以Pages应用的activate
动作为例。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
modules | | pages | | apps | | pages | | subApps | | browser | | actions | | activate | | catalog | website | class | info.magnolia.ui.framework.action.ActivationActionDefinition | command | activate | icon | icon-publish | label | Publish |
|
改变列
在树型和列表视图中改变显示的列。您可以在内容视图(树,列表,搜索)中找到列配置。以下为Assets应用的一个例子,在应用的树型视图里显示的列和列表视图里的相同,唯一的不同在于,路径列被省去了。扩展到已有配置并改写特定值的好处是,您总是能准确的知道您定制了什么。
Advanced Tables - Table Plus |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
workbench | | contentViews | | tree | | columns | | path | | enabled | false | extends | ../../list/columns | class | info.magnolia.ui.workbench.tree.TreePresenterDefinition | list | | columns | | asset | | path | | title | | status | | moddate | |
|
开启定制对话框
改变动作定义来开启您自己的对话框,而不是打开默认的。在dialogName
属性里找到对话框。这里有一个在Contacts应用里提及对话框的例子。对话框定义在这里不展示了,您可以在同一个模块里找到。
Advanced Tables - Table Plus |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
browser | | actions | | addFolder | | editFolder | | class | info.magnolia.ui.framework.action.OpenEditDialogActionDefinition | dialogName | contacts:folder | icon | icon-edit | label | Rename folder |
|
在对话框里改变域
将域添加到对话框里,或改变已有域。参考对话框。
创建一个编辑器组件
编辑器是一个编辑内容的组件。它通常会像对话框一样显示表格,不同之处在于,编辑器是包含在子应用里的。您可以随意打开很多子应用,也就是说,您可以同时编辑很多条目。这对于对话框来说不可能。在对话框里,您只能一次编辑一个条目。
Advanced Tables - Table Plus |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
modules | | dam | | apps | | assets | | subApps | | browser | | detail | | editor | | form | | actions | | nodeType | | workspace | dam |
|
编写您自己的视图
如果您想要编写自己的视图呢?假设您希望用一个您写的叫做com.acme.sample.app.main.ContentDisplayViewAcme
的类替换info.magnolia.sample.app.main.ContentDisplayView
。
正确的实现您定制视图的方法是,创建一个新模块来扩展已有的模块。在新模块的描述符(sample-app-acme.xml)中,指向现有的那个模块。只改变唯一的 <component>
组件来指向这个新配置。
Code Block |
---|
language | html/xml |
---|
title | 示例应用里最开始定义的ContentDisplayView |
---|
|
<id>app-sample</id>
<component>
<type>info.magnolia.sample.app.main.ContentDisplayView</type>
<implementation>info.magnolia.sample.app.main.ContentDisplayViewImpl</implementation>
</component>
</components> |
Code Block |
---|
language | html/xml |
---|
title | 在您自己的模块里改写标准视图 |
---|
|
<id>acme-app-sample</id>
<component>
<type>info.magnolia.sample.app.main.ContentDisplayView</type>
<implementation>com.acme.sample.app.main.ContentDisplayViewImplAcme</implementation>
</component>
</components> |