Hi,

Is there a way to display tabs like a classic menu structure (like the default navigation menu for instance, with submenus directly placed after the parent item) ? It could allow me to create a "local tasks" block.

For instance on admin/access/rules I would have a block which displays :
-(leaf)permissions
-(leaf)roles
-(expanded)access rules(active)
-(leaf)list
-(leaf)add rule
-(leaf)check rules

On api.drupal.org, i see :

theme_menu_local_tasks : Returns the rendered local tasks. The default implementation renders them as tabs.

Can I override the default implementation ? If so where can i find some tips on writing the code ?
Or is there a way to customize it in the theme directly ?

Comments

geeloo’s picture

In case someone is interested, here's what I put in my "local tasks" block.
It probably needs optimization but it works on 4.7.2.

$menu = menu_get_local_tasks();
$pid = menu_get_active_nontask_item();
$output = '';
  if (!isset($menu[$pid]) || !$menu[$pid]['children']) {
    return;
  }
  else
  {
    $output .= '<ul class="menu">';
    foreach ($menu[$pid]['children'] as $mid) {
      $type = isset($menu[$mid]['type']) ? $menu[$mid]['type'] : NULL;
      $children = '';
      if (isset($menu[$mid]) && $menu[$mid]['children'] && menu_in_active_trail($mid)) {
        $children .= '<ul class="menu">';
        foreach ($menu[$mid]['children'] as $cid) {
          $type = isset($menu[$cid]['type']) ? $menu[$cid]['type'] : NULL;
          $children .= theme('menu_item',$cid);
        }
        $children .= '</ul>';
      }
      $output .= theme('menu_item',$mid, $children, count($menu[$mid]['children']) == 0);
    }
  $output .= '</ul>';
  print $output;
}
ssiruguri’s picture

I don't have enough expertise to say for sure, but I think what you need is to over ride the CSS that dictates the display of the local tasks items.