Theming book navigation block to generate drop-down menus I have a 3 level deep book navigation block. I'd like to change the menu tree HTML output in the following way: For each level of the tree, create a li and inside it put an anchor tag with the active-trail link for that level, and afterwards a ul with the rest of the siblings for that level.

&lt;li&gt;
    &lt;a href="#" class="active-trail level[x]"&gt;Level[x] active trail link&lt;/a&gt;
    &lt;ul style="display:none;"&gt;
        &lt;li&gt;&lt;a href="#"&gt;Level[x] sibling1&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Level[x] sibling2&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Level[x] sibling3&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Level[x] sibling4&lt;/a&gt;&lt;/li&gt;        
    &lt;/ul&gt;
&lt;/li&gt;


The order of sibling links appearance should be according to their corresponding node weight.

I thought this could be done via the theme_menu_link() function but I can't seem to find a way to pass the current item's depth to the function. 

What function do I have to work with in order to achieve what I'm after? Can someone offer some guidance?

Thanks,
Avner
There is a specific theme function, which is used from the Book module for outputting its own block of links to book pages. I am not sure if it suits your case, but you can always use that code to build your own theme function.

The theme function is called from book_block(), using the following code:

  if (variable_get('book_block_mode', 'all pages') == 'all pages') {
    $block['subject'] = t('Book navigation');
    $book_menus = array();
    $pseudo_tree = array(0 =&gt; array('below' =&gt; FALSE));
    foreach (book_get_books() as $book_id =&gt; $book) {
      if ($book['bid'] == $current_bid) {
        // If the current page is a node associated with a book, the menu
        // needs to be retrieved.
        $book_menus[$book_id] = menu_tree_output(menu_tree_all_data($node-&gt;book['menu_name'], $node-&gt;book));
      }
      else {
        // Since we know we will only display a link to the top node, there
        // is no reason to run an additional menu tree query for each book.
        $book['in_active_trail'] = FALSE;
        $pseudo_tree[0]['link'] = $book;
        $book_menus[$book_id] = menu_tree_output($pseudo_tree);
      }
    }
    $block['content'] = theme('book_all_books_block', $book_menus);
  }


The theme_book_all_books_block() function is empty, because the theme is using a template (book-all-books-block.tpl.php); as far as I can see, there isn't a preprocess function for that template file.