Defining Relations
The Content Store's relation concept allows related items to be managed in an organized and standardized way.
Relations are added to content type definitions by first defining a
relation-type-group
(as a child of the root
content-types
element):
<relation-type-group name="attachments"> <relation-type name="pictures"> <ui:label>Pictures</ui:label> </relation-type> <relation-type name="stories"> <ui:label>Stories</ui:label> </relation-type> </relation-type-group>
The relation-type-group
element contains a list of
one or more relation-type
elements. This group of
relation types can then be included in content type definitions by
adding ref-relation-group
elements to
content-type
elements. For example:
<content-type name="legacy-story"> ... <ref-relation-type-group name="attachments"/> ... </content-type>
This would add the relation types images
and
stories
to the content type
legacy-story
. You can define as many
relation-type-group
s as you wish in a
content-type
resource, and you can re-use the same
relation-type-group
in many content type
definitions if you wish.
Relation types are displayed as drop zones in editor metadata panels in CUE. Dropping a content item in one of another content item's relation drop zones creates a relationship between them. You can restrict what types of content item may be dropped in a particular relation type by specifying allowed content types as follows:
<relation-type-group name="attachments"> <relation-type name="pictures"> <ui:label>Pictures</ui:label> <allow-content-types> <ref-content-type name="picture"/> </allow-content-types> </relation-type> <relation-type name="stories"> <ui:label>Stories</ui:label> <allow-content-types> <ref-content-type name="story"/> <ref-content-type name="legacy-story"/> </allow-content-types> </relation-type> </relation-type-group>