I want to do something that would seem rather simple: remove the link from the title of the book block that displays when a user is browsing a book. I could not find a way to do that other than to change the following code from the book module, line 216
$block['subject'] = theme('book_title_link', $data['link']);
changed to:
$block['subject'] = $title;

I'd rather not hack core to accomplish what I'm trying to do, but I can't find another way to do it.

The reason for trying to do this is that I'm using a javascript that replaces the block titles with an image, and it won't work if there are links in the

tags.

Thanks.

Comments

mtsanford’s picture

You need to override the theme function for book_title_link.

Copy theme_book_title_link() function from the book module, and paste it into your themes template.php file.

Rename the function to YOUR_THEME_NAME_book_title_link, or phptemplate_book_title_link

Edit at will.

Oh, and empty your cache at admin/settings/performance or equivalent. Always, always, always do this when things are not going as you expect. It can save a lot of headaches.

RWWood’s picture

There does not appear to be a way to actually delete the link and keep the title using that function. I tried that first, but was unable to do anything with it. If you (or anyone) can point me in the right direction, I'd appreciate the help.

mtsanford’s picture

function YOUR_THEME_book_title_link($link) {
return $link['title'];
}

RWWood’s picture

Hmmm..... I thought I had tried that and that it hadn't worked. Maybe I forgot to clear the cache after I made the changes

In any case, thanks.

Diegen’s picture

Thanks that worked for me:

function mythemename_book_title_link($link) {
  return $link['link_title'];
}