I know the PF module's stance on the content to be printed is that only $node variables are considered.

But I believe that nowadays, most sites are building content outside of this scope. Core blocks, views, contexts, spaces, panels and more are all used to present instances of content to a user.

In my case, we use context.module to turn on block content for certain nodes. This content is just as important as the $node content.

I wrote a module that allows me to inject theme $regions to the content displayed by PF. But I discovered that not all blocks were being displayed.

This turned out to be because they were managed with contexts. The node's context is not set when the PF display is rendered.

I fixed this with the following code within hook_nodeapi / view:

<?php
  $print = strtolower(arg(0)) == 'print' ? TRUE : FALSE;
  
  // This is a printer-friendly page
  if ($print) {
  
    if (module_exists('context')) {
      // catch the printer-friendly version of the page and enable
      // contexts for the node as print.module does not support context
      context_node_condition($node, 'view');
    }
  }
?>

Maybe this will help someone else.

Comments

harry slaughter’s picture

Issue summary: View changes

updated

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

Harry,

Nice tip.. I love the context module, myself, so I understand what you're saying.. Have you tried adding this code in the _print_generate_node() function?

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No further info in two weeks. Closing the issue.

jcnventura’s picture

Issue summary: View changes

yup