Namespace: components

Granite.author. components

Array of components available on the page

Initialized by Document#event:cq-components-loaded; available on Document#event:cq-editor-loaded

Source:
storage/components.js

Members


allowedComponents :Array.<Granite.author.Component>

All the allowed components in the page

Initialized by Document#event:cq-components-filtered

Type:
Source:
storage/components.js

allowedComponentsFor :Object

Allowed components for a given path

Where the key is the path of an Granite.author.Editable

Initialized by Document#event:cq-components-filtered

Type:
  • Object
Source:
storage/components.js

Methods


add(components)

Adds one or more components to the components store

Parameters:
Name Type Description
components Array.<Granite.author.Component> | Granite.author.Component

List of components to be added

Source:
storage/components.js

clean()

Deletes all components from the components store

Source:
storage/components.js
Fires:

computeAllowedComponents(editable, design)

Returns an array of string representing the list of allowed components

Those could be either a path, a resource type or component group

The component store also stores the list in its Granite.author.components.allowedComponentsFor registry later usage and retrieval

Parameters:
Name Type Description
editable Granite.author.Editable

Editable for which to compute a list of allowed components

design Object

Design configuration object from which to get the actual configuration

Source:
storage/components.js
Returns:
  • An array of string in case of a configuration object has been found or undefined otherwise
Type
Array.<string> | undefined

filterAllowedComponents(filter [, append])

Updates the allowed components based on the given filter

Parameters:
Name Type Argument Description
filter Array.<string>

list of terms to search for. May be paths, resource types or groups

append boolean <optional>

Should the found list of components be added to the allowed components of the current store

Source:
storage/components.js
Fires:

find(search)

Find components based ont the give search criteria

Parameters:
Name Type Description
search string | Object | Object

Component path or RegExp to match multiple path of components

Properties
Name Type Description
findFirst boolean

Indicates if the search should return the first component matching.
Only to be used when searching by path.

Source:
storage/components.js
Returns:

List of components or single component if findFirst set to true

Type
Array.<Granite.author.Component> | Granite.author.Component

getGroups(components)

Returns the groups fro the given components

Parameters:
Name Type Description
components Granite.author.Component

The list of components from which to get the groups

Source:
storage/components.js
Returns:
Type
Array.<string>

remove(components)

Removes components from the components store

Parameters:
Name Type Description
components Array.<Granite.author.Component> | Granite.author.Component

List of components to be removed

Source:
storage/components.js

set(components)

Sets components in the components store and deletes all previous existing components

Parameters:
Name Type Description
components Array.<Granite.author.Component> | Granite.author.Component

List of components to be added

Source:
storage/components.js
Fires: