public function aroundGetChildData(AbstractBlock $subject, callable $proceed, $alias, $key = '')
 {
     $returnValue = $proceed($alias, $key);
     if (null === $returnValue) {
         $layout = $subject->getLayout();
         if (!$layout) {
             return false;
         }
         $name = $layout->getChildName($subject->getNameInLayout(), $alias);
         if ($layout->isContainer($name)) {
             $returnValue = $layout->getElementProperty($name, $key);
         }
     }
     return $returnValue;
 }
Ejemplo n.º 2
0
 /**
  * Return button parent block
  *
  * @param \Magento\Framework\View\Element\AbstractBlock $context
  * @param string $region
  * @return \Magento\Backend\Block\Template
  */
 protected function getToolbar(\Magento\Framework\View\Element\AbstractBlock $context, $region)
 {
     $parent = null;
     $layout = $context->getLayout();
     if (!$region || $region == 'header' || $region == 'footer') {
         $parent = $context;
     } elseif ($region == 'toolbar') {
         $parent = $layout->getBlock('page.actions.toolbar');
     } else {
         $parent = $layout->getBlock($region);
     }
     if ($parent) {
         return $parent;
     }
     return $context;
 }
Ejemplo n.º 3
0
 /**
  * @param AbstractBlock $block
  *
  * @return string
  */
 protected function _getBlockNamePath(AbstractBlock $block)
 {
     $layout = $block->getLayout();
     $blockName = $block->getNameInLayout();
     $path = $this->_getElementPath($layout, $blockName);
     return isset($path) ? $path . " / " . $blockName : $blockName;
 }