Documentation

Mage_Core_Model_Layout extends Config
in package

Maho

Tags
copyright

Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)

copyright

Copyright (c) 2016-2025 The OpenMage Contributors (https://openmage.org)

copyright

Copyright (c) 2024-2025 Maho (https://mahocommerce.com)

license

https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

Table of Contents

Properties

$_area  : string
Layout area (f.e. admin, frontend)
$_blocks  : array<string|int, mixed>
Blocks registry
$_cache  : Mage_Core_Model_Cache
Cache resource object
$_cacheChecksum  : string|false|null
$_cacheId  : string
$_cacheLifetime  : int
$_cacheSaved  : bool
$_cacheTags  : array<string|int, mixed>
$_directOutput  : bool
Flag to have blocks' output go directly to browser as oppose to return result
$_elementClass  : string
Class name of simplexml elements for this configuration
$_helpers  : array<string|int, mixed>
Helper blocks cache for this layout
$_output  : array<string|int, mixed>
Cache of block callbacks to output during rendering
$_update  : Mage_Core_Model_Layout_Update
Layout Update module
$_xml  : Element|SimpleXMLElement|null
Configuration xml
$_xpathExtends  : mixed
Xpath describing nodes in configuration that need to be extended
$invalidActions  : mixed

Methods

__construct()  : mixed
Class constructor
addBlock()  : Mage_Core_Block_Abstract
Add a block to registry, create new object if needed
addOutputBlock()  : $this
Add a block to output
applyExtends()  : $this
Process configuration xml
createBlock()  : Mage_Core_Block_Abstract|false
Block Factory
extend()  : $this
fetchCacheChecksum()  : bool
findTranslationModuleName()  : string
Lookup module name for translation from current specified layout node
generateBlocks()  : mixed
Create layout blocks hierarchy from layout xml configuration
generateXml()  : $this
Loyout xml generation
getAllBlocks()  : array<string|int, Mage_Core_Block_Abstract>
Retrieve all blocks from registry as array
getArea()  : string
Retrieve layout area
getBlock()  : Mage_Core_Block_Abstract|false
Get block object by name
getBlockSingleton()  : Mage_Core_Block_Abstract|stdClass
getCache()  : Mage_Core_Model_Cache
getCacheChecksum()  : string|false|null
getCacheChecksumId()  : string
getCacheId()  : string
getCacheLifetime()  : int
getCacheSaved()  : bool
getCacheTags()  : array<string|int, mixed>
getDirectOutput()  : bool
Retrieve derect output flag
getMessagesBlock()  : Mage_Core_Block_Messages
Retrieve messages block
getNode()  : Element|false
Returns node found by the $path
getOutput()  : string
Get all blocks marked for output
getUpdate()  : Mage_Core_Model_Layout_Update
Layout update instance
getXmlString()  : string
Return Xml of node as string
getXpath()  : array<string|int, Element>|false
Returns nodes found by xpath expression
helper()  : Mage_Core_Helper_Abstract|false
Retrieve helper object
loadCache()  : bool
loadDom()  : bool
Imports DOM node
loadFile()  : bool
Imports XML file
loadString()  : bool
Imports XML string
processFileData()  : string
Stub method for processing file data right after loading the file text
removeCache()  : $this
removeOutputBlock()  : $this
saveCache()  : $this
setArea()  : Mage_Core_Model_Layout
Set layout area
setBlock()  : $this
Save block in blocks registry
setCache()  : self
setCacheChecksum()  : $this
setCacheId()  : $this
setCacheLifetime()  : $this
setCacheSaved()  : $this
setCacheTags()  : $this
setDirectOutput()  : Mage_Core_Model_Layout
Declaring layout direct output flag
setNode()  : $this
Create node by $path and set its value.
setXml()  : $this
Sets xml for this configuration
unsetBlock()  : $this
Remove block from registry
updateCacheChecksum()  : $this
validateCacheChecksum()  : bool
_generateAction()  : $this
_generateBlock()  : $this
Add block object to layout based on xml node data
_getBlockInstance()  : Mage_Core_Block_Abstract
Create block object instance based on block type
_loadCache()  : bool
_removeCache()  : mixed
_saveCache()  : bool
_translateLayoutNode()  : mixed
Translate layout node
validateAgainstBlacklist()  : mixed

Properties

$_area

Layout area (f.e. admin, frontend)

protected string $_area

$_blocks

Blocks registry

protected array<string|int, mixed> $_blocks = []

$_cacheChecksum

protected string|false|null $_cacheChecksum = false

$_cacheId

protected string $_cacheId = null

$_cacheLifetime

protected int $_cacheLifetime = null

$_cacheSaved

protected bool $_cacheSaved = false

$_cacheTags

protected array<string|int, mixed> $_cacheTags = []

$_directOutput

Flag to have blocks' output go directly to browser as oppose to return result

protected bool $_directOutput = \false

$_elementClass

Class name of simplexml elements for this configuration

protected string $_elementClass = \Maho\Simplexml\Element::class

$_helpers

Helper blocks cache for this layout

protected array<string|int, mixed> $_helpers = []

$_output

Cache of block callbacks to output during rendering

protected array<string|int, mixed> $_output = []

$_xml

Configuration xml

protected Element|SimpleXMLElement|null $_xml = null

$_xpathExtends

Xpath describing nodes in configuration that need to be extended

protected mixed $_xpathExtends = '//*[@extends]'
Tags
example

$invalidActions

protected mixed $invalidActions = [ // explicitly not using class constant here Mage_Page_Block_Html_Topmenu_Renderer::class // if the class does not exists it breaks. ['block' => 'Mage_Page_Block_Html_Topmenu_Renderer', 'method' => 'render'], ['block' => 'Mage_Core_Block_Template', 'method' => 'fetchview'], ]

Methods

__construct()

Class constructor

public __construct() : mixed

addOutputBlock()

Add a block to output

public addOutputBlock(string $blockName[, string $method = 'toHtml' ]) : $this
Parameters
$blockName : string
$method : string = 'toHtml'
Return values
$this

applyExtends()

Process configuration xml

public applyExtends() : $this
Return values
$this

extend()

public extend(Config $config[, bool $overwrite = true ]) : $this
Parameters
$config : Config
$overwrite : bool = true
Return values
$this

fetchCacheChecksum()

public fetchCacheChecksum() : bool
Return values
bool

findTranslationModuleName()

Lookup module name for translation from current specified layout node

public static findTranslationModuleName(Varien_Simplexml_Element $node) : string

Priorities:

  1. "module" attribute in the element
  2. "module" attribute in any ancestor element
  3. layout handle name - first 1 or 2 parts (namespace is determined automatically)
Parameters
$node : Varien_Simplexml_Element
Return values
string

generateXml()

Loyout xml generation

public generateXml() : $this
Return values
$this

getArea()

Retrieve layout area

public getArea() : string
Return values
string

getCacheChecksum()

public getCacheChecksum() : string|false|null
Return values
string|false|null

getCacheChecksumId()

public getCacheChecksumId() : string
Return values
string

getCacheId()

public getCacheId() : string
Return values
string

getCacheLifetime()

public getCacheLifetime() : int
Return values
int

getCacheSaved()

public getCacheSaved() : bool
Return values
bool

getCacheTags()

public getCacheTags() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDirectOutput()

Retrieve derect output flag

public getDirectOutput() : bool
Return values
bool

getNode()

Returns node found by the $path

public getNode([string $path = null ]) : Element|false
Parameters
$path : string = null
Tags
see
Element::descend
Return values
Element|false

getOutput()

Get all blocks marked for output

public getOutput() : string
Return values
string

getXmlString()

Return Xml of node as string

public getXmlString() : string
Return values
string

getXpath()

Returns nodes found by xpath expression

public getXpath(string $xpath) : array<string|int, Element>|false
Parameters
$xpath : string
Return values
array<string|int, Element>|false

loadCache()

public loadCache() : bool
Return values
bool

loadDom()

Imports DOM node

public loadDom(DOMNode $dom) : bool
Parameters
$dom : DOMNode
Return values
bool

loadFile()

Imports XML file

public loadFile(string $filePath) : bool
Parameters
$filePath : string
Return values
bool

loadString()

Imports XML string

public loadString(string $string) : bool
Parameters
$string : string
Return values
bool

processFileData()

Stub method for processing file data right after loading the file text

public processFileData(string $text) : string
Parameters
$text : string
Return values
string

removeCache()

public removeCache() : $this
Return values
$this

removeOutputBlock()

public removeOutputBlock(string $blockName) : $this
Parameters
$blockName : string
Return values
$this

saveCache()

public saveCache([array<string|int, mixed> $tags = null ]) : $this
Parameters
$tags : array<string|int, mixed> = null
Return values
$this

setCacheChecksum()

public setCacheChecksum(string|null $data) : $this
Parameters
$data : string|null
Return values
$this

setCacheId()

public setCacheId(string $id) : $this
Parameters
$id : string
Return values
$this

setCacheLifetime()

public setCacheLifetime(int $lifetime) : $this
Parameters
$lifetime : int
Return values
$this

setCacheSaved()

public setCacheSaved(bool $flag) : $this
Parameters
$flag : bool
Return values
$this

setCacheTags()

public setCacheTags(array<string|int, mixed> $tags) : $this
Parameters
$tags : array<string|int, mixed>
Return values
$this

setNode()

Create node by $path and set its value.

public setNode(string $path, string $value[, bool $overwrite = true ]) : $this
Parameters
$path : string

separated by slashes

$value : string
$overwrite : bool = true
Return values
$this

setXml()

Sets xml for this configuration

public setXml(Element $node) : $this
Parameters
$node : Element
Return values
$this

unsetBlock()

Remove block from registry

public unsetBlock(string $name) : $this
Parameters
$name : string
Return values
$this

updateCacheChecksum()

public updateCacheChecksum(string|false $data) : $this
Parameters
$data : string|false
Return values
$this

validateCacheChecksum()

public validateCacheChecksum() : bool
Return values
bool

_loadCache()

protected _loadCache(string $id) : bool
Parameters
$id : string
Return values
bool

_removeCache()

protected _removeCache(string $id) : mixed
Parameters
$id : string
Tags
todo

check this, as there are no caches that implement remove() method

_saveCache()

protected _saveCache(string $data, string $id[, array<string|int, mixed> $tags = [] ][, int|bool $lifetime = false ]) : bool
Parameters
$data : string
$id : string
$tags : array<string|int, mixed> = []
$lifetime : int|bool = false
Return values
bool

_translateLayoutNode()

Translate layout node

protected _translateLayoutNode(Varien_Simplexml_Element $node, array<string|int, mixed> &$args) : mixed
Parameters
$node : Varien_Simplexml_Element
$args : array<string|int, mixed>

        
On this page

Search results