Hi,
I'm new on Drupal and I would like to know how can I make properly such comment
on items Menu please ?
-> each first row is a link and each 2nd row is a comment...
- Menu 1
(my explanation)
- Menu 2
(other explanation ...)
...
The only solution i've found is to do that (below)... but i'm sure it's not a
property way...
- the only constraint i have is to have the abbility to get the Description
field in the underlying menu to display a dynamic comment.
but actually, the only trick I've found to get the Description is to parse the
HTML string to retrieve the "title" tag to get my text.
Not very cool, i think...
- actually, to determine the underlying nodes menu, i'm testing her names... is
there another way to do that ?
Can you help me please ?
Regards
Cédric
function myTheme_menu_item($link, $has_children, $menu = '', $in_active_trail =
FALSE, $extra_class = NULL) {
$class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'));
if (!empty($extra_class)) {
$class .= ' '. $extra_class;
}
if ($in_active_trail) {
$class .= ' active-trail';
}
$css_id = strip_tags($link);
// test the node for which i want to add comment
if (stripos($link, 'MyMenu1') > 0 || stripos($link, 'MyMenu2') > 0) {
$rec = 'title="';
$i = stripos($link, $rec);
if ($i > 0) {
$j = strpos($link, '"', $i+strlen($rec));
if ($j > 0)
$title = substr($link, $i+strlen($rec), $j-$i-strlen($rec));
}
}
$title = ($title != "") ? '<div
class="views-field-created"><h0> [' . $title .
']</h0></div>' : '';
return '<li class="'. $class .'">'. $link . $menu ."</li>\n" . $title;
}