Top
craft-uikit
craft-widget-

ComponentStack

ComponentStack

Source:

Provides global Component access.

You may love to setCraft.Core.Defaults.ALLOW_COMPONENT_SHORTCUT = true to be able to access component via its id.

Example in your template

<!-- fully qualified -->
<div onclick="window.Craft.Core.ComponentStack.get('${componentId}').action()">action</div>

<!-- ALLOW_COMPONENT_SHORTCUT is true -->
<div onclick="${componentId}.action()">action</div>

Methods

(static) push()

Source:

Shortcut for set

(static) set(componentId, component)

Source:

Set component into the stack

Parameters:
Name Type Description
componentId String

componentId

component Craft.Core.Component

component

(static) get(componentId)

Source:

Get component from the stack

Parameters:
Name Type Description
componentId string

componentId

(static) del(componentId)

Source:

Delete component from the stack

Parameters:
Name Type Description
componentId string

componentId

(static) nextSerial() → {Number}

Source:

Publish new serial number. Actual componentId will be made by its packagename.

Returns:
Type
Number