Пример #1
0
 /**
  * Run action defined in layout update
  *
  * @param Mage_Core_Model_Layout_Element $node
  * @param Mage_Core_Model_Layout_Element $parent
  */
 protected function _generateAction($node, $parent)
 {
     $configPath = $node->getAttribute('ifconfig');
     if ($configPath && !Mage::getStoreConfigFlag($configPath)) {
         return;
     }
     $method = $node->getAttribute('method');
     $parentName = $node->getAttribute('block');
     if (empty($parentName)) {
         $parentName = $parent->getElementName();
     }
     $profilerKey = 'BLOCK_ACTION:' . $parentName . '>' . $method;
     Magento_Profiler::start($profilerKey);
     $block = $this->getBlock($parentName);
     if (!empty($block)) {
         $args = $this->_extractArgs($node);
         $this->_translator->translateActionParameters($node, $args);
         call_user_func_array(array($block, $method), $args);
     }
     Magento_Profiler::stop($profilerKey);
 }
Пример #2
0
 /**
  * @dataProvider elementNameDataProvider
  */
 public function testGetElementName($xml, $name)
 {
     $model = new Mage_Core_Model_Layout_Element($xml);
     $this->assertEquals($name, $model->getElementName());
 }