static function getItems() { if (!self::$_items) { $config = Mage::app()->getConfig()->getNode(); self::$_items = array(); // FIXME: Ajax XPath config: There are so many configs and the listing is slow // $this->xml2array($config, $items); // This will get all configs (they are a lot of them) self::xml2array($config->global, self::$_items, 'global'); } return self::$_items; }
public function searchConfigAction() { if ($this->getRequest()->isPost()) { $result['error'] = 0; $query = $this->getRequest()->getPost('query'); if (!empty($query)) { $configs = Mage::app()->getConfig()->getNode($query); $items = array(); Magneto_Debug_Block_Config::xml2array($configs, $items, $query); $block = new Mage_Core_Block_Template(); //Is this the correct way? $block->setTemplate('debug/configsearch.phtml'); $block->assign('items', $items); echo $block->toHtml(); } else { $result['error'] = 1; $result['message'] = 'Search query cannot be empty.'; } } }
/** * Seach config * * @return void */ public function searchConfigAction() { if ($this->getRequest()->isPost()) { $result['error'] = 0; $query = $this->getRequest()->getPost('query'); if (!empty($query)) { $configs = Mage::app()->getConfig()->getNode(); $configArray = array(); Magneto_Debug_Block_Config::xml2array($configs, $configArray); $configKeys = array_keys($configArray); $items = array(); foreach ($configKeys as $configKey) { if (strpos($configKey, $query) !== FALSE) { $items[$configKey] = $configArray[$configKey]; } } $block = $this->getLayout()->createBlock('debug/abstract'); $block->setTemplate('debug/configsearch.phtml'); $block->assign('items', $items); $this->getResponse()->setBody($block->toHtml()); } else { $result['error'] = 1; $result['message'] = $this->__('Search query cannot be empty.'); } } }