Page History
...
clear | both |
---|---|
width | 343px |
align | right |
class | menu |
This page provides an overview of all ways to define custom JCR node types and create new workspaces with Magnolia.
...
Create an XML-based node type definition file in your light module:
Code Pro language xml title /content-type-examples/jcr-node-type-files/travellers-node-types.xml <?xml version="1.0" encoding="UTF-8"?> <nodeTypes xmlns:mgnl="http://www.magnolia.info/jcr/mgnl" xmlns:mt="https://www.magnolia-travel.com/jcr/1.0/mt"> <nodeType name="mt:traveller" isMixin="false" hasOrderableChildNodes="true" primaryItemName=""> <supertypes> <supertype>mgnl:content</supertype> </supertypes> </nodeType> <nodeType name="mt:tourGuide" isMixin="false" hasOrderableChildNodes="true" primaryItemName=""> <supertypes> <supertype>mt:traveller</supertype> </supertypes> </nodeType> <nodeType name="mt:happyCustomer" isMixin="false" hasOrderableChildNodes="true" primaryItemName=""> <supertypes> <supertype>mt:traveller</supertype> </supertypes> </nodeType> </nodeTypes>
Reference the node type definition from a content type definition:
Code Pro language yml title /content-type-examples/contentTypes/happyCustomer.yaml linenumbers true datasource: workspace: happycustomers autoCreate: true nodeTypeDefinition: /content-type-examples/jcr-node-type-files/travellers-node-types.xml model: nodeType: mt:happyCustomer properties: - name: country - name: age type: Double
Line 4: References the node type definition resource via
nodeTypeDefinition
.
...
Overview
Content Tools