new Block(layout, options)
Constructor
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
layout |
Layout | Layout instance | |||||||||||||||||||||
options |
Object | Block options
Properties
|
Members
-
config :Object
-
Config object
Type:
- Object
-
data :string
-
Block data object, it's the object passed to twig for render
Type:
- string
-
html :string
-
Block html
Type:
- string
-
layout :Layout
-
Layout instance
Type:
-
name :string
-
Block name
Type:
- string
-
page :string|null
-
Block page path
Type:
- string | null
-
parent :string
-
block parent name take from config or options
Type:
- string
-
template :string
-
template path
Type:
- string
Methods
-
addBlocks(blocks)
-
Add many blocks
Parameters:
Name Type Description blocks
Array blocks configs array -
<async> afterInitChildren()
-
afterLoadChrildren hook called after all blocks are loaded
-
<async> afterLoad()
-
AfterLoad hook called after all blocks are loaded
-
<async> beforeRender()
-
beforeRender hook Call before the render
-
getBlock(name)
-
Get a block instance by name
Parameters:
Name Type Description name
string Block name Returns:
Block instance- Type
- Block
-
getChildrenBlock()
-
return the children block to load after this block init
-
<async> init()
-
Init callback call at the end of construct
-
<async> isCached()
-
Check if the block render is cached
Returns:
- Type
- Boolean
-
<async> render()
-
Render the block Render the children blocks and the block
Returns:
Block html rendered- Type
- string