Hello!

On my web I use the collapse text module, that allows sections of text to be collapsible. It is possible to show this sections collapse by default. But when the printer friendly version of the page is loaded, the text is still displayed collapsed. This makes impossible to print the collapsed text properly.

To avoid this problem I added a line in the "print.pages.inc" that replace all the "collapse collapsed" classes with "collapse" classes using str_replace() in print_controller_html() function.

Original print_controller_html() function, that respect collapsed text settings:

31    $html = theme('print_page', $print, PRINT_HTML_FORMAT, $node);
32    $html = drupal_final_markup($html);
33    print $html;

Modified function that renders all collapsible texts expanded:

31    $html = theme('print_page', $print, PRINT_HTML_FORMAT, $node);
32    $html = drupal_final_markup($html);
+     $html = str_replace("collapsible collapsed","collapsible",$html); 
33    print $html;

This works for me, but I'm not sure if this can create problems with other modules. I wonder if it is possible to create a setting in printer friendly module that allows:
a) Respect the collapsed text settings (like the module does now)
b) Display all collapsible texts expanded
c) Display all collapsible texts collapsed

Thank you very much :D

Comments

jcnventura’s picture

Title: Collapse text module » Support the 'print' build mode
Project: Printer, email and PDF versions » Collapse Text
Version: 6.x-1.12 » 6.x-2.7

The Collapse Text module needs to respect the 'print' build (D6) view (D7) modes.

Note that the 'print' mode is the mode used in the printer-friendly version of the core book module. As core is not going to start supporting collapsed text, I would think that the only safe choice is to for that module to display the text uncollapsed when it detects that mode.

When it does that, the 'print' module will no longer show the text collapsed.

pukku’s picture

Hi! I'm not sure where this is coming from. Can you give me some more background? What module is this print mode related to?

Thanks,
Ricky

dydave’s picture

Category: Feature request » Support request
Status: Active » Closed (cannot reproduce)

No more feedback on this issue for more than two years.

I would assume a solution should have already been found by ticket's author who posted more than three years ago.

Additionally ticket's author didn't provide any additional information, even though it had been explicitly requested by @pukku in #1. On top of that, no follow-up was ever given to this issue for over two years, leading us to guess that perhaps this issue was somehow resolved in another module or Drupal Core with newer versions.

Since it doesn't seem like anyone could ever reproduce the problem, I allowed myself to mark this issue as Closed (cannot reproduce) for now, but feel free to re-open it, or post a new ticket, at any time if you have any further objections with this ticket (we would surely be happy to hear your feedback).

Please let us know if you would have any further comments, feedback, questions, issues, objections, suggestions or concerns on this comment or ticket in general, we would be glad to provide more information or explain in more details.

Many thanks to everyone for your great help, reviews, testing, reporting and participation for the improvement of this module.
Cheers!

dureaghin’s picture

$html = str_replace("collapsible collapsed","collapsible",$html);
This works for Drupal 7 too! Thank you "tectokronos"

anthonyroundtree’s picture

Is there anyway this function can be added to dev or is there a way to add this to a print function?

dydave’s picture

Hi @anthonyroundtree,

Could you please tell us a little bit more about this issue?

What modules are you guys talking about?

What modules do you use to print?

What version of Drupal? (for example 7.55)

I would like to help fixing the problem, but I need a better idea of what you are all talking about....

Thanks very much in advance.