Website Brick parent Class

Instance

Instance of Brick is available as DOM property with name "Brick" on brick container element

Constructors

  • Constructs Brick instance

    Parameters

    • brickId: string

      Brick UID

    • brickName: string

      Brick Name

    • brickPath: string

      Brick Path

    • Optional extend: BrickExtend

      Object to be extended, should have at least init() function

    Returns Brick

Properties

DEBUG: boolean

Enables some internal debugging output to JS console eg. Config data Default is false for production environment and true for development

brickName: undefined | string

Brick Name

brickPath: undefined | string

Brick Path relative to website root

brickUID: undefined | string

Brick Unique ID in current document

domElement?: null | HTMLElement

Brick HTML DOM Element of the main Brick container (wrapper)

editmode: boolean

Is TRUE if view is currently in editmode Works only for bricks using action.php extending Website\Tag\Area\ActionObject

init?: ((brickId?) => {})

Called when Brick is created and associated with DOM element
Works only for bricks using action class extending Web4People\TemplateEngineBundle\AbstractTemplateAreabrick

Type declaration

    • (brickId?): {}
    • Called when Brick is created and associated with DOM element
      Works only for bricks using action class extending Web4People\TemplateEngineBundle\AbstractTemplateAreabrick

      Parameters

      • Optional brickId: string

      Returns {}

        See

        Use onBrickInit instead

        Deprecated

        Use onBrickInit instead

    See

    Use onBrickInit instead

    Deprecated

    Use onBrickInit instead

    initialized?: boolean
    onBrickInit?: ((event) => {})

    Called when Brick is created and associated with DOM element

    Type declaration

      • (event): {}
      • Called when Brick is created and associated with DOM element

        Parameters

        • event: CustomEvent<any>

        Returns {}

      onScrollMagicAvailable?: ((event) => {})

      Called when ScrollMagic is available for this widget

      Type declaration

        • (event): {}
        • Called when ScrollMagic is available for this widget

          Parameters

          • event: CustomEvent<any>

          Returns {}

        wrapper: null | JQuery<HTMLElement>

        Brick HTML DOM Element of the main Brick container wrapped as JQuery Object

        Methods

        • Returns config passed from brick PHP

          To pass config value to Brick JS you can use: action.php


          $this->setBrickJSConfig('some-key', $value); //some JSON serializable value

          Returns Config

        • Gets HTML DOM Element of the main Brick container

          Returns null | HTMLElement

          domElement Brick Wrapper DOM element

        • Returns a live HTMLCollection which contains every Brick descendant element which has the specified class name or names.

          Parameters

          • Optional names: string

            is a string representing the list of class names to match; class names are separated by whitespace

          Returns void | HTMLCollectionOf<Element>

        • Returns brick Name

          Returns undefined | string

        • Returns brick path relative to website root

          Returns undefined | string

        • If enabled in Widget Configuration, Returns initialized ScrollMagic Controller object singleton instance
          To pass options to Controller constructor set window.ScrollMagicControllerOptions = {options}

          Returns undefined | {}

        • Returns brick Unique ID in current document

          Parameters

          • Optional prefix: string

            optional prefix eg. '#' to get JQuery compatible selector

          Returns undefined | string

        • Returns Brick Wrapper as JQuery Object
          Before calling this function JQuery should be loaded using standard async load otherwise warn message is displayed and HTMLElement is returned instead

          brick.js Sample:

          Please note "jquery" in define call
          define(["jquery"], function ($) {
          return function (brickId, brickName, brickPath, Brick) {
          return new Brick(brickId, brickName, brickPath, {
          // init function runs at the end of the constructor so "new Brick" above doesn't return usable value until init function is finished!
          init: function () {
          var wrapper = this.getWrapper();
          }
          });
          };
          });

          or note "jquery" in require call

          define([], function () {
          return function (brickId, brickName, brickPath, Brick) {
          return new Brick(brickId, brickName, brickPath, {
          init: function () {
          var me = this;
          require(["jquery"], function($) {
          var wrapper = me.getWrapper();
          });
          }
          });
          };
          });

          Returns null | HTMLElement | JQuery<HTMLElement>

        • Returns TRUE if view is currently in editmode Works only for bricks using action.php extending Website\Tag\Area\ActionObject

          Returns boolean

        • Call Action on Brick server side instance using fetch API

          Parameters

          • key: string

            Action key

          • params: {
                [index: string]: any;
            }

            Action parameters as key-value pairs

            • [index: string]: any

          Returns Promise<any>

        • Add Event Listener to brick Dom Element

          Parameters

          • event: string
          • callback: ((event) => boolean | void)
              • (event): boolean | void
              • Parameters

                Returns boolean | void

          Returns void

        • Sets HTML DOM Element of the main Brick container

          Parameters

          • domElement: null | HTMLElement

            Brick Wrapper DOM element

          Returns void

        Generated using TypeDoc