Problem/Motivation

When asking for the Printer-friendly version on any book page like https://drupal.org/documentation/mobile or one of it's sub pages the output contains Add new comment for every (sub page).

This is not printer friendly.

How to reproduce

  1. Visit i.e. Native mobile apps https://drupal.org/node/1388470
  2. Click Printer-friendly version https://drupal.org/book/export/html/1388470
  3. Search for Add new comment (There are ~ 6 links)

Proposed resolution

Wait for the core fix #2141929: Comment link or form is added to print view mode.

The other quick fixes are all still core hot fix on the misc/print.css which are more bad then good. The better should be solved through #1338858: Include theme print stylesheets in Book printer friendly export.

Remaining tasks

Is this a book.module bug?

User interface changes

API changes

Comments

clemens.tolboom’s picture

Assigned: clemens.tolboom » Unassigned
Related issues: +#303143: Generate hierarchical books

I've tested this on a clean Drupal 7 install locally using the Devel patch #303143: Generate hierarchical books using the UI not drush to generate 500 nested book pages.

The comment links are not visible so guess this is d.o specific.

I'm not sure how I can help any further now.

clemens.tolboom’s picture

Issue summary: View changes
helmo’s picture

Confirmed.

The css selector "li.comment-add" might be a bit better though.

clemens.tolboom’s picture

A core hack works but I needed to find the real cause.

$ bzr diff .
=== modified file 'modules/book/book.module'
--- modules/book/book.module	2013-08-08 23:33:06 +0000
+++ modules/book/book.module	2013-11-22 10:26:45 +0000
@@ -1278,6 +1278,8 @@
  */
 function book_node_export($node, $children = '') {
   $build = node_view($node, 'print');
+  No need for comment links
+  unset($build['links']['comment']);
   unset($build['#theme']);
   // @todo Rendering should happen in the template using render().
   $node->rendered = drupal_render($build);

The title for the comment link is comment/comment.module: 'attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')), which has some logic not respecting 'print' view mode

          if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE || (!empty($node->comment_count) && user_access('access comments'))) {

coming from #754760: "Add new comment" appears directly above comment form / "post comments" does not work without "access comments" permission.

clemens.tolboom’s picture

Removed the misc/print.css

A quick fix would be to hide the inline links which are generated by the book module.

// misc/print.css
ul.inline {
    display: none;
}
clemens.tolboom’s picture

Just tried https://drupal.org/book/export/html/2127611 to review #3

The patch done in #2141929: Comment link or form is added to print view mode. hides the the comment link when using the 'print' view mode.

I do thinks ALL links should be dropped when requesting a printer friendly page. Ie Facebook share or flag links should not be displayed either. Fortunately we do not have these or the modules do it right?

Below a snippet from the mentions export page above.

<ul class="links inline"><li class="comment-add first last"><a href="/comment/reply/2127611#comment-form" title="Share your thoughts and opinions related to this posting.">Add new comment</a></li>
</ul>

Please review #2141929: Comment link or form is added to print view mode.

tvn’s picture

Status: Active » Postponed
Issue tags: +Drupal.org 7.1

Postponing till the core issue is fixed.

tvn’s picture

Project: [Archive] Drupal.org D7 upgrade QA » Drupal.org customizations
Version: » 7.x-3.x-dev
Issue tags: -Drupal.org 7.1

Moving to customizations to wait till the core issue is fixed.

drumm’s picture

Status: Postponed » Closed (outdated)

With #2762837: [Meta] Migrate documentation into the new system, Drupal.org no longer has the book module enabled.