On a book page, it would be nice to be able to optionally show the teaser with a node's title. eg.

Existing compact view:

  • Section 1: Intro
  • Section 2: Starting

Optional view with teasers:

  • Section 1: Intro
    Introduction to this subject will help you get started
  • Section 2: Starting
    This is where you begin to learn about this subject in more detail

Comments

peterx’s picture

book.modules contains:
$variables['tree'] = book_children($book_link);
book_children contains:

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

includes/menu.inc menu_tree_output has:
$output .= theme('menu_item', $link, $data['link']['has_children'], '', $data['link']['in_active_trail'], $extra_class);

In theory you could override the output using a module or theme function. The name would be something like book_menu_item. You could read the node to get the teaser. You could make the extra processing an option. You could make the code an optional add on module named book_child_index_tester. The book developers migth pick it up and package it with the book module. I would like something like this but it is item 78 on my list of 10 things I have to do this month.

iantresman’s picture

Looks interesting, and I hope to find some time to try it out.

Thanks.

aspiration’s picture

book.module:

function book_children($book_link) {
  $flat = book_get_flat_menu($book_link);
  $chld = '<hr><ul>';
  if ($book_link['has_children']) {
    do {
      $link = array_shift($flat);
    } while ($link && ($link['mlid'] != $book_link['mlid']));
    while (($link = array_shift($flat)) && $link['plid'] == $book_link['mlid']) {
      $result = pager_query(db_rewrite_sql("SELECT nid FROM {book} WHERE book.mlid=".$link['mlid']), 1, 0, NULL, $account->uid);
      $rw = db_fetch_object($result);
      $chld .= '<li>'.node_view(node_load($rw->nid), 1).'</li>';
    }
  }
  $chld .= '</ul>';
  return $chld;
}
rovo’s picture

Is this meant to display the teaser as well? Where would you put this code?

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.