This plugin is used to create templates into the system. A template is a presentation to display the saved information.

The node type template is used to edit and display the node content. Each node type has one _dialog1.gtmpl_ file (dialog template) for editing/creating a node and one _view1.gtmpl_ file (view template) for viewing the node content.
Using the dialog template, you can specify a dialog whose fields correspond to the properties of the node you want to edit their values. When this template is rendered,
each specified field will appear with a data input box for you to edit. Note that you do not have to
design a dialog in which all data of the node are listed to be edited. You can just list the subset of node data you want to edit.
Like the dialog template, the view template renders information of the node. You just need to create the template and specify which data fields to be displayed.
With this kind of template, node information is only displayed but cannot be edited.
See details at [ContentType|#CONTref.CONTref.InsideWCMTemplates.ContentTypes].

To use the plugin in the component configuration, you must use the following target-component:

{code:xml}
<target-component>org.exoplatform.services.cms.templates.TemplateService</target-component>
{code}

The configuration is applied mainly in _packaging/wcm/webapp/src/main/webapp/WEB-INF/conf/dms-extension/dms/dms-templates-configuration.xml_.

*Sample configuration*:

This below example is configuration for the _{noformat}nt:file{noformat}_ template, any other template will be put in the same level with this template starting from the line
_{noformat}<object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$NodeType>{noformat}_ as the another node type.

{code:xml}
<external-component-plugins>
    <target-component>org.exoplatform.services.cms.templates.TemplateService</target-component>
    <component-plugin>
        <name>addTemplates</name>
        <set-method>addTemplates</set-method>
        <type>org.exoplatform.services.cms.templates.impl.TemplatePlugin</type>
        <init-params>
            <value-param>
                <name>autoCreateInNewRepository</name>
                <value>true</value>
            </value-param>
            <value-param>
                <name>storedLocation</name>
                <value>war:/conf/dms-extension/dms/artifacts/templates</value>
            </value-param>
            <value-param>
                <name>repository</name>
                <value>repository</value>
            </value-param>
            <object-param>
                <name>template.configuration</name>
                <description>configuration for the localtion of templates to inject in jcr</description>
                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig">
                    <field name="nodeTypes">
                        <collection type="java.util.ArrayList">
                            <value>
                                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$NodeType">
                                    <field name="nodetypeName">
                                        <string>nt:file</string>
                                    </field>
                                    <field name="documentTemplate">
                                        <boolean>true</boolean>
                                    </field>
                                    <field name="label">
                                        <string>File</string>
                                    </field>
                                    <field name="referencedView">
                                        <collection type="java.util.ArrayList">
                                            <value>
                                                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                                                    <field name="templateFile">
                                                        <string>/file/views/view1.gtmpl</string>
                                                    </field>
                                                    <field name="roles">
                                                        <string>*</string>
                                                    </field>
                                                </object>
                                            </value>
                                            <value>
                                                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                                                    <field name="templateFile">
                                                        <string>/file/views/admin_view.gtmpl</string>
                                                    </field>
                                                    <field name="roles">
                                                        <string>*:/platform/administrators</string>
                                                    </field>
                                                </object>
                                            </value>
                                        </collection>
                                    </field>
                                    <field name="referencedDialog">
                                        <collection type="java.util.ArrayList">
                                            <value>
                                                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                                                    <field name="templateFile">
                                                        <string>/file/dialogs/dialog1.gtmpl</string>
                                                    </field>
                                                    <field name="roles">
                                                        <string>*</string>
                                                    </field>
                                                </object>
                                            </value>
                                            <value>
                                                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                                                    <field name="templateFile">
                                                        <string>/file/dialogs/admin_dialog.gtmpl</string>
                                                    </field>
                                                    <field name="roles">
                                                        <string>*:/platform/administrators</string>
                                                    </field>
                                                </object>
                                            </value>
                                        </collection>
                                    </field>
                                    <field name="referencedSkin">
                                        <collection type="java.util.ArrayList">
                                            <value>
                                                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                                                    <field name="templateFile">
                                                        <string>/file/skins/Stylesheet-lt.css</string>
                                                    </field>
                                                    <field name="roles">
                                                        <string>*</string>
                                                    </field>
                                                </object>
                                            </value>
                                            <value>
                                                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                                                    <field name="templateFile">
                                                        <string>/file/skins/Stylesheet-rt.css</string>
                                                    </field>
                                                    <field name="roles">
                                                        <string>*</string>
                                                    </field>
                                                </object>
                                            </value>
                                        </collection>
                                    </field>
                                </object>
                            </value>
                        </collection>
                    </field>
                </object>
            </object-param>
        </init-params>
    </component-plugin>
</external-component-plugins>
{code}
In which:

* *name*: _addTemplates_

* *set-method*: _addTemplates_

* *type*: _org.exoplatform.services.cms.templates.impl.TemplatePlugin_

* *Init-params*:

||*Value-param*||*Type*||*Value*||*Description*||
|autoCreateInNewRepository|{{boolean}}|{{true}}|Enable the application to import predefined templates at the start-up of template service automatically.|
|storedLocation|{{string}}|{{war:/conf/dms-extension/dms/artifacts/templates}}|The location of stored templates.|
|repository|{{string}}|{{repository}}|Location of stored templates.|

* *Object-type*: _org.exoplatform.services.cms.templates.impl.TemplateConfig_ that defines all available template files, using the "collection type" configuration.

* *type*: It is the name of each object type. It means the type of template, the further configurations for this type are defined by some specified fields.
||*Field* || *Type*||*Value* ||*Description*||
|*nodeTypes*|{{ArrayList}}| {{ {noformat}{java.util.ArrayList}{noformat} }}| The node type of the template.|

* *Object-type*: {{org.exoplatform.services.cms.templates.impl.TemplateConfig$NodeType}}
||*Field*||*Type*||*Value* ||*Description*||
|*nodetypeName*|{{string}}|nt:file |The name of template that is saved as a node in system.|
|*documentTemplate*|{{boolean}}| {{true}}|Determine if the node type is a document type.|
|*label*|{{string}}| {{file}}| Visual display of the title for this node.|
|*referencedView*|{{ArrayList}} |{{ {noformat}{java.util.ArrayList}{noformat} }} |Determine how to display a view. |
|*referencedDialog*|{{ArrayList}} |{{ {noformat}{java.util.ArrayList}{noformat} }}|Determine how to display a dialog to input information. |
|*referencedSkin*|{{ArrayList}} |{{ {noformat}{java.util.ArrayList}{noformat} }}|Determine the stylesheet for display. |

* *Object type:* {{org.exoplatform.services.cms.templates.impl.TemplateConfig$Template}}

||*Field *||*Type*||*Description*||
|*templateFile*|{{string}}|The location of the file store for the template's presentation.|
|*roles*|{{string}}|Determine who can access this object (View/Dialog/CSS).|