How to define an unlisted type of content
How to define an unlisted type of content and how to create such a content?
Occasionally, you need to define components that are not listed in the list of usable components. As an example, you could imagine a way to add some text on the bottom of the footer as a copyright, but you don't want this component to be available or used anywhere else.
Here is a way to do it:
First, define the component that you want to have:
[jnt:copyright] > jnt:content, mix:title - jcr:title (string) = 'Copyright Your Website 2022' internationalized
Then define a list for this type of component.
[jnt:copyrightList] > jnt:contentList, jmix:hiddenType +* (jnt:copyright)
In these definitions, you can observe 2 things:
jnt:copyrightis not droppable content, so you can't use it from anywhere
jnt:copyrightListinherit from the
jmix:hiddenTypeso this content list won't be listed
As is, we cannot create any
jnt:copyright on our page.
To be able to instantiate a copyright text, you can add the following line in your JSP template:
<template:area path="copyright" areaAsSubNode="true" nodeTypes="jnt:copyright" areaType="jnt:copyrightList"/>
This will declare a copyright list that should only display a
Better, and for a typical optional copyright text, you could limit the number of items to 1 and set the list as an absolute area, so the same content will be displayed on all pages.
<template:area path="copyright" areaAsSubNode="true" nodeTypes="jnt:copyright" areaType="jnt:copyrightList" level="0" moduleType="absoluteArea" listLimit="1"/>