I have a task to customize Book outline to:

  • force the pages of the book to be read from start to finish. Once a page has been read it can be revisited.
  • show the progress through the book.

I was thinking of using the outline links to do this. For pages that have not been read the outline item would not be a link. Once the page has been read it becomes a link.

I am fairly new to Drupal and have some experience creating and modifying modules. It would seem that this could be accomplished by extending the Book module but I have not looked at the code yet.

Does this seem like the best way to go or is there an existing module that would help?

  • If I were to modify the book module directly it would seem that the work would be done in book-navigation.tpl.php and template_preprocess_book_navigation. I am guessing that there is a way to extend Book to do this without modifying core. Jan 10 '14 at 3:46
  • If now see that the code referenced in my previous comment is for modifying the links at the bottom of the pages, not the outline. However, I have yet to find the equivalent code that creates the outline. Jan 10 '14 at 4:13
  • I have now determined that the outline is created with template_preprocess_book_all_books_block and book-all-books-block.tpl.php. Now the question is how to hook into these without hacking book. There does not seem to be a convenient hook alter. Jan 11 '14 at 0:24
  • I am now trying out the Course module which at least keeps track of which pages have been visited in a book and marks the course as complete if all of the pages have been visited. Jan 13 '14 at 22:09

The Course module has the facilities needed to implement these features. With a few code and css tweaks and otherwise standard Drupal content and block configurations I was able to satisfy these requirements to a large degree.

I should have explained in the original post that my site is actually a series of training modules. I had originally planned to make this a book with the pages being the training modules. With the Course module I instead created a book for the top level container and then added the courses (using the course content type) to this book. Inside each course was another book that held the actual content pages. I forced the user to navigate the pages of the course using the navigation links at the bottom of each page by hiding the outline until they had finished each course. They could also see their progress by navigating through the courses to see which ones they had completed (with a large green check mark). This is not a perfect solution but it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.