[development] create a block with menu links
Lluís Forns
enboig at gmail.com
Wed Sep 29 10:49:00 UTC 2010
After some research, I think the easiest way is to create a block in
my module and the in $delta=view put:
$menu = array(
'path1' => 'title1',
'path2' => 'title2',
);
foreach($menu AS $key => $value) {
if (!menu_get_item($key)) {
unset($menu[$key]);
}
else {
$menu[$key] = l($value, $key);
}
}
$block['content'] = theme_item_list($menu);
return $block;
It don't need and extra module and as it don't have any configuration,
it is easier to push changes from development site to production site.
--
*Les normes hi són perquè hi pensis abans de saltar-te-les
*La vida és com una taronja, què esperes a exprimir-la?
*Si creus que l'educació és cara, prova la ignorància.
*La vida és com una moneda, la pots gastar en el que vulguis però
només una vegada.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.
2010/9/29 Nikola Kotur <kotnick at gmail.com>:
> On Wed, 2010-09-29 at 09:58 +0200, Lluís Forns wrote:
>
> In my module I want to create a block with menu links. Which is the
> correct way to do it so permissions are checked?
>
> Why don't you use Menu Block module (http://drupal.org/project/menu_block )?
> Or, you could see in it how it should be properly done.
>
>
More information about the development
mailing list