Hello... I'm wondering if anyone can help me with an issue I'm having where all I want to do is show the complete outline of a book hierarchy in the content view, with all the child and leaf nodes listed out as clickable links? Thanks for any help.

-G

Comments

arhip’s picture

Hi. Maybe this is what you're looking for: project/booktree

gwatzn’s picture

this module definitely helps to achieve part of what I'm trying to do, though I wish it had some more configuration options. Luckily the module isn't overly huge and I might be able to customize it for my needs. I just wish that there was a way to set a flag within the content of a book page to make the entire navigation tree of the child pages expand, basically enabling a full-fledged table of contents underneath the text within the top-level page in a book.

hakeem’s picture

Hello gwatzn, have you managed to do it?

00qazs’s picture

Ok I have solution to this. You have to enable the booktree.module first in order for this to work:
Add this line of code to the core book.module, under the book_children($book_link) function:

***
    while (($link = array_shift($flat)) && $link['plid'] == $book_link['mlid']) {
      $data['link'] = $link;
      $data['below'] = '';
      $children[] = $data;
    }
  }

/* Code to be added */
$node = node_load(array('nid' => $book_link['nid']));
$ricursione=1;
$maxricursione=variable_get('booktree_deep', 5)+2;
$trimval=variable_get('booktree_trim', 35);
	
$content = booktree_mostra_figli($node->book['mlid'],
$node->nid,$node->title,$ricursione,$maxricursione,
$trimval,$node->book['mlid']);

/* Replace the return line */
return $children ? $content : ''

And that's all. You should be able to view the expanded version.

nonzero’s picture

How would you incorporate this into a separate module from Book? I don't want to patch Book because it is a core module that is susceptible to change upon upgrading Drupal. I've never made a module before so any pointers would be appreciated.