You are here

function book_link in Drupal 5

Same name and namespace in other branches
  1. 4 modules/book.module \book_link()
  2. 6 modules/book/book.module \book_link()

Implementation of hook_link().

File

modules/book/book.module, line 59
Allows users to collaboratively author a book.

Code

function book_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  if ($type == 'node' && isset($node->parent)) {
    if (!$teaser) {
      if (book_access('create', $node) && $node->status == 1) {
        $links['book_add_child'] = array(
          'title' => t('Add child page'),
          'href' => "node/add/book/parent/{$node->nid}",
        );
      }
      if (user_access('see printer-friendly version')) {
        $links['book_printer'] = array(
          'title' => t('Printer-friendly version'),
          'href' => 'book/export/html/' . $node->nid,
          'attributes' => array(
            'title' => t('Show a printer-friendly version of this book page and its sub-pages.'),
          ),
        );
      }
    }
  }
  return $links;
}