Page History
...
In the following example, it is specified that the 'column' layout can contain any component or layout layout from the current package and any component except the one named or with layoutName "container" (from any package).
Code Block | ||||
---|---|---|---|---|
| ||||
{ { "name": "column", "displayName": "Column", "version": 1, "icon": "12grid/column.png", "definition": "column.json", "excludes": ["container"], "model": { } } } |
We can also disallow adding any component with "excludes": ["component"]. However, if we want to allow all components but a specific one, then we need to use the "contains" property instead of "excludes", in which we enumerate all possible components that this layout accepts.
More Examples on "contains" and "excludes" properties
The possible values of the "contains" property are illustrated in the table bellow, it can either contain everything "*" or it can be an array containing layout names or the string "component":
Contains Values | Explanation | Example 12grid package | The Add menu |
---|---|---|---|
* | may contain any layouts from the current package and any components from any packages | "contains": ["*"] | |
<layoutName>
| may contain layout with name <layout_name> or with the layoutName property <layout_name> from the current package | "contains": ["container"] | |
"contains": ["row"] | |||
component | may contain any components from any package | "contains": ["component"] | |
enummeration of <layoutName> and optionally component | may contain the enummerated layouts from the current package and components from any packages | "contains": ["row","container","component"] |
If a specific layout can contain everything except a few other layouts or it cannot contain components, then it is better to use the excludes property instead of contains:
Excludes values | Explanation | Example 12grid package | The Add menu |
---|---|---|---|
<layoutName> | may contain any layouts from the current package and any components except the layout with name <layout_name> or with the layoutName property <layout_name> | "excludes": ["row"] | |
component | may only contain layouts from the current package, excludes all components | "excludes":["component"] | |
enummeration of <layoutName> and optionally component | may contain all layouts from the current package except the ones enummerated; if components is specified, then the current layout cannot contain any components | "excludes": ["row","container","component"] |
Note |
---|
Only one of the contains and excludes properties should be present in a layout specification. If excludes is present, then contains will be ignored. |