I want to change the text in the book module that appear at the bottom of the pages saying

< > and Up

to Icons to make the pages more interesting.

Anyone know where this is done?

With thanks,

Ed

Comments

bjornarneson’s picture

Override this function from book.module with a phptemplate_book_navigation() function in your template.php file. You can change the $links to whatever icon you'd like.

/**
 * Prepares the links to children (TOC) and forward/backward
 * navigation for a node presented as a book page.
 *
 * @ingroup themeable
 */
function theme_book_navigation($node) {
  $output = '';

  if ($node->nid) {
    $tree = book_tree($node->nid);

    if ($prev = book_prev($node)) {
      drupal_add_link(array('rel' => 'prev', 'href' => url('node/'. $prev->nid)));
      $links .= l(t('‹ ') . $prev->title, 'node/'. $prev->nid, array('class' => 'page-previous', 'title' => t('Go to previous page')));
    }
    if ($node->parent) {
      drupal_add_link(array('rel' => 'index', 'href' => url('node/'. $node->parent)));
      $links .= l(t('up'), 'node/'. $node->parent, array('class' => 'page-up', 'title' => t('Go to parent page')));
    }
    if ($next = book_next($node)) {
      drupal_add_link(array('rel' => 'next', 'href' => url('node/'. $next->nid)));
      $links .= l($next->title . t(' ›'), 'node/'. $next->nid, array('class' => 'page-next', 'title' => t('Go to next page')));
    }

    if (isset($tree) || isset($links)) {
      $output = '<div class="book-navigation">';
      if (isset($tree)) {
        $output .= $tree;
      }
      if (isset($links)) {
        $output .= '<div class="page-links">'. $links .'</div>';
      }
      $output .= '</div>';
    }
  }

  return $output;
}
ehasted’s picture

Thanks - will try this later on today and report back.

willi.firulais’s picture

Hallo,
Thx a lot for this hint. But do you have some idea how I may add some spans arround the arrows?

<a ... class="page-previous"><span class="symbol">< my link translated text</span></a>
<a ... class="page-up"><span class="symbol">^</span></a>
<a ... class="page-next"><span class="symbol">> my tranlated link text</span></a>

I have tried it but the spans always are written out in escaped form.

The idea is to the the <>^ rendered into the html and when needed to set for display: none and use instead of this some background images.

All hints and workarounds are welcome.

Thx, Willi

bjornarneson’s picture

with css, add some rules to your stylesheet to add background-images to the book navigation

.page-links .page-previous {
  text-indent: -999em;
  background-image: [your icon path here];
  ...
  ...
}

The theme override is probably the better option, though.

b

ehasted’s picture

As I said I'll try both these techniques. Very many thanks - Ed