Answer the question
In order to leave comments, you need to log in
How to work with menu_tree and menu_link in Drupal?
Dear drupalists! Boiling brain. Nothing works! The bottom line is this: I started learning Drupal. I decided to create a theme from scratch, and at the same time figure out what's what in this cms. The first thing I came across was the need to customize the menu. You can, of course, stupidly display it through a block with your markup, but I want to be able to work with it in normal mode through the admin panel. I read on the Internet how to do it, people on toster advised: redefine the functions menu_tree (wrapper for the entire menu) and menu_link (wrapper for the menu item). The problem is that nothing changes at all. Fragment where the region for the menu is displayed (page.tpl.php):
<body>
<div id="main">
<div id="header"></div>
<?php print render($page['header_menu']); ?>
<div id="info">
<div id="container"></div>
</div>
</div>
</body>
<?php
function factor_menu_tree__main_menu($variables) {
return '<ul class="topNav">' . $variables['tree'] . '</ul>';
}
name = factor
description =Factor theme
package = Core
version = VERSION
core = 7.x
stylesheets[all][] = style.css
regions[header_menu] = Меню
regions[content] = Content bottom
Answer the question
In order to leave comments, you need to log in
The answer was simple: you need to use the machine name of the created menu, but I used just the name. Everything worked out.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question