Custom content types may have relationships to each other or other content types.
For instance, a person may have an image, or an employee may have a boss, or belong
to a department. These relationships must be defined with a specific relationship type, then used
in the custom content with an input type
ContentSelector. The relationship type definition
is an XML file. It must be placed in the folder,
relationship-type.xml. Here is an example of a relationship-type:
<relationship-type> <display-name>Citation</display-name> <from-semantic>citation in</from-semantic> <to-semantic>cited by</to-semantic> <allowed-from-types/> <allowed-to-types> <content-type>com.enonic.xp.modules.features:article</content-type> </allowed-to-types> </relationship-type>
- Text to describe the “from” relationship.
- Text to describe the “to” relationship.
- Any content type may use this relationship-type.
- Wherever this relationship-type is used, only an article may be selected.
The content types have the format
The module may be
system for built-in types.
System relationship types¶
There are two default relationship types that may be used out of the box. These represent general relationship types that may be reused often.
- No content type restriction, from-semantic = “relates to”, to-semantic = “related of”.
- No content type restriction, from-semantic = “parent of”, to-semantic = “child of”.