Child pages
  • WebLayouts

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: SVY-12129 improve the WebLayouts wiki page

...

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
languagejs
titlecolumn.spec
{
	{
	"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 ValuesExplanationExample 12grid packageThe Add menu
*may contain any layouts from the current package and any components from any packages"contains": ["*"]Image Added

<layoutName>

 


may contain layout with name <layout_name> or with the layoutName property <layout_name> from the current package"contains": ["container"] 
"contains": ["row"]Image Added
componentmay contain any components from any package"contains": ["component"]Image Added
enummeration of <layoutName> and optionally component may contain the enummerated layouts from the current package and components from any packages"contains": ["row","container","component"]Image Added

 

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 valuesExplanationExample 12grid packageThe 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"]

Image Added
componentmay only contain layouts from the current package, excludes all components"excludes":["component"]Image Added
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"]Image Added
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.