/** * Get the default items * * @param Mage_Core_Model_Layout_Element $xml * @param string $method * @return array */ protected function _getDefaultItems($xml, $method) { $defaults = array(); foreach ($xml->children() as $handle => $node) { if ($handle !== 'default') { continue; } if ($actions = $node->xpath(".//action[@method='" . $method . "']")) { foreach ($actions as $action) { $defaults[] = (string) $action->script; } } } return array_unique($defaults); }
/** * Update args according to its type * * @param Mage_Core_Model_Layout_Element $node * @return array */ protected function _extractArgs($node) { $args = (array) $node->children(); unset($args['@attributes']); foreach ($args as $key => $arg) { if ($arg instanceof Mage_Core_Model_Layout_Element) { if (isset($arg['helper'])) { $args[$key] = $this->_getArgsByHelper($arg); } else { /** * if there is no helper we hope that this is assoc array */ $arr = $this->_getArgsFromAssoc($arg); if (!empty($arr)) { $args[$key] = $arr; } } } } if (isset($node['json'])) { $json = explode(' ', (string) $node['json']); foreach ($json as $arg) { $args[$arg] = Mage::helper('Mage_Core_Helper_Data')->jsonDecode($args[$arg]); } } return $args; }