Page History
...
- JCR workspace
- JCR nodetype
This node type inherits from the Magnolia node typemgnl:content
. To define more sophisticated node types, you can create a node type definition file in a light module. - JCR namespace
Example
Code Pro | |||||||
---|---|---|---|---|---|---|---|
| |||||||
datasource: workspace: tourguides namespaces: mt: https:// | gitwww.magnolia- | cmstravel.com/ | usersjcr/ | cmeier/repos/content-type-examples/raw/contentTypes/tourGuide.yaml?at=master1.0/mt
autoCreate: true
model:
nodeType: mt:tourGuide
properties:
- name: birthday
type: Date
- name: gender
- name: shortBio |
Bestpractice |
---|
If a node type inheriting from |
...
Create an XML-based node type definition file in your light module:
Code Pro profile bitbucket-cmeier-repolanguage xml title /content-type-examples/jcr-node-type-files/travellers-node-types.xml url git<?xml version="1.0" encoding="UTF-8"?> <nodeTypes xmlns:mgnl="http://www.magnolia.info/jcr/mgnl" xmlns:mt="https://
cmswww.magnolia-
/users/cmeier/repos/content-type-examples/raw/jcr-node-type-files/travellers-node-types.xml?at=mastertravel.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 profile bitbucket-cmeier-repolanguage yml title /content-type-examples/contentTypes/happyCustomer.yaml linenumbers true url https://git.magnolia-cms.com/users/cmeier/repos/ raw/contentTypes/happyCustomer.yaml?at=masterdatasource: 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