Да, это немного странно, но она сводится к следующему:
Вызов $this->getHtml('level-top')
относится к блоку класса Mage_Page_Block_Html_Topmenu
($this
является экземпляром этого класса) с помощью метода внутрь:
public function getHtml($outermostClass = '', $childrenWrapClass = '')
{
Mage::dispatchEvent('page_block_html_topmenu_gethtml_before', array(
'menu' => $this->_menu,
'block' => $this
));
$this->_menu->setOutermostClass($outermostClass);
$this->_menu->setChildrenWrapClass($childrenWrapClass);
if ($renderer = $this->getChild('catalog.topnav.renderer')) {
$renderer->setMenuTree($this->_menu)->setChildrenWrapClass($childrenWrapClass);
$html = $renderer->toHtml();
} else {
$html = $this->_getHtml($this->_menu, $childrenWrapClass);
}
Mage::dispatchEvent('page_block_html_topmenu_gethtml_after', array(
'menu' => $this->_menu,
'html' => $html
));
return $html;
}
->$outermostClass
имеет значение top-level
Оттуда вы видите вызов $renderer->toHtml()
, где $renderer
является примером Mage_Page_Block_Html_Topmenu_Renderer
.
protected function _toHtml()
{
$this->_addCacheTags();
$menuTree = $this->getMenuTree();
$childrenWrapClass = $this->getChildrenWrapClass();
if (!$this->getTemplate() || is_null($menuTree) || is_null($childrenWrapClass)) {
throw new Exception("Top-menu renderer isn't fully configured.");
}
$includeFilePath = realpath(Mage::getBaseDir('design') . DS . $this->getTemplateFile());
if (strpos($includeFilePath, realpath(Mage::getBaseDir('design'))) === 0 || $this->_getAllowSymlinks()) {
$this->_templateFile = $includeFilePath;
} else {
throw new Exception('Not valid template file:' . $this->_templateFile);
}
return $this->render($menuTree, $childrenWrapClass);
}
Этот метод в настоящее время загружает файл шаблона в переменную $includeFilePath
, в моем случае /vagrant/app/design/frontend/rwd/default/template/page/html/topmenu/renderer.phtml
(в зависимости от темы вы используете).
Я не мог обнаружить использование $outermostClass
со значением top-level
.