Hello,
I'm trying to get some info about block in an observer but I haven't been able to get the alias (or 'as' parameter in layout xml). I've tried several different things without success. Here is a look at my (partial) code:
public function getBlockInfo( \Magento\Framework\View\Element\BlockInterface $block, $fullInfo = true ){ $info = array( 'name' => $block->getNameInLayout(), 'alias' => '', //TODO: Add block alias to list );
return $info; }
Can anyone help me out here ?
Thanks
Solved! Go to Solution.
How to use the Magento 2 layout's getElementAlias() method to get the alias of a block or a contaner? https://mage2.pro/t/700
How to use the Magento 2 layout's getElementAlias() method to get the alias of a block or a contaner? https://mage2.pro/t/700
Thank you, worked like a charm