- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2016
07:35 AM
02-12-2016
07:35 AM
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.
Labels:
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2016
02:00 PM
02-12-2016
02:00 PM
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
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2016
02:00 PM
02-12-2016
02:00 PM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2016
12:08 AM
02-15-2016
12:08 AM
Re: How to get a block's alias (as) programmatically
Thank you, worked like a charm