protected function loadRewrites()
{
$prototype = $this->_rewriteTypes;
$return = array_combine($prototype, array_fill(0, count($prototype), array()));
// Load config of each module because modules can overwrite config each other. Global config is already merged
$modules = \Mage::getConfig()->getNode('modules')->children();
foreach ($modules as $moduleName => $moduleData) {
// Check only active modules
if (!$moduleData->is('active')) {
continue;
}
// Load config of module
$configXmlFile = \Mage::getConfig()->getModuleDir('etc', $moduleName) . DIRECTORY_SEPARATOR . 'config.xml';
if (!is_readable($configXmlFile)) {
continue;
}
$xml = \simplexml_load_file($configXmlFile);
if (!$xml) {
continue;
}
$rewriteElements = $xml->xpath('//*/*/rewrite');
foreach ($rewriteElements as $element) {
$type = dom_import_simplexml($element)->parentNode->parentNode->nodeName;
if (!isset($return[$type])) {
continue;
}
foreach ($element->children() as $child) {
$groupClassName = dom_import_simplexml($element)->parentNode->nodeName;
$modelName = $child->getName();
$return[$type][$groupClassName . '/' . $modelName][] = (string) $child;
}
}
}
return $return;
}