Class: Component

Granite.author. Component

Represents a AEM component resource


new Component(html)

Parameters:
Name Type Description
html HTMLElement

The HTML element that represents the current component. This HTML element holds all the data describing the actual component

Source:
model/Component.js
See:

Members


componentConfig :Object

Component configuration. Piece of data describing the actual component

Type:
  • Object
Source:
model/Component.js

html :HTMLElement

Component card as HTMLElement

Type:
  • HTMLElement
Source:
model/Component.js

Methods


<private> _executeListener()

Executes the specified listener with the specified parameters

Source:
model/Component.js
Returns:

Returns the value resulting from the listener's execution.
If the listener is a "beforeoperation" listener, and it explicitly returns false,
then the operation should be aborted.

Type
Boolean

beforeInsert(defaultInsertFunction, parentEditable)

Executes the beforeInsert listener

Parameters:
Name Type Description
defaultInsertFunction function

The default insert operation to be applied (to allow clients to override it).

parentEditable Editable

The Editable that will be the parent of the new Editable.

Source:
model/Component.js
Returns:

Returns the value resulting from the listener's execution.
If the listener explicitly returns false, then the operation should be aborted.

Type
Boolean

getComponentConfig()

Returns the component configuration

Source:
model/Component.js
Returns:

Component configuration

Type
Object

getDropTarget(id)

Returns the drop targets associated with the current component.

In this context drop target refers to an asset to component mapping

Those configuration resources are located under path/to/component/cq:editConfig/cq:dropTargets

Parameters:
Name Type Description
id string

if passed a single drop target object will be returned

Source:
model/Component.js
See:
Returns:

null if not found or empty

Type
Array | Object

getGroup()

Returns the component path

Source:
model/Component.js
Returns:

Component group

Type
String

getPath()

Returns the component resource path

Source:
model/Component.js
Returns:

Component path

Type
String

getResourceType()

Returns the component resource type

Source:
model/Component.js
Returns:

Component resource type

Type
String

getTemplatePath()

Returns the component template path

Source:
model/Component.js
Returns:

Component template path

Type
String

getTitle()

Returns the component title

Source:
model/Component.js
Returns:

Component title

Type
String

getTypeName()

Returns the type name for the Class

Source:
model/Component.js

toHtml()

Returns the component as HTMLElement

Source:
model/Component.js
Returns:
Type
HTMLElement