Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
In my print_mail e-mails, I would like to display node teasers, as themed by my existing node-type.tpl.php files. Is this possible?
I tried to do this by setting Send only the teaser in print's e-mail settings. However, the module seems to then build the node as configured in its Print Display Settings. I would like, however, to use my node templates, as they already have a themed display that runs if $teaser = TRUE.
I imagine I am doing something wrong, but can't figure it out. Thanks in advance all!
Comment | File | Size | Author |
---|---|---|---|
#5 | print-template_teaser-707484-5.patch | 440 bytes | jfrederick |
Comments
Comment #1
jfrederick CreditAttribution: jfrederick commentedI think the code that is causing my difficulty is in print.pages.inc (587-591):
The call to the theme function does fill $content with templated output, including a teaser if that is passed, but then if teaser had indeed been passed, the themed output is overwritten with the default print display style (drupal_render($node->content)).
Comment #2
jfrederick CreditAttribution: jfrederick commentedMy solution for this problem:
This makes two settings in the module stop functioning: in /settings/print/email Send only the teaser and Enable teaser/full mode choice. No matter what I now check for these, it will always send the teaser. Which is okay for me, but beware of the downfalls of a hack!
Comment #3
jcnventura CreditAttribution: jcnventura commentedI don't test the teaser-only mode often.. That code that overwrites the content var with the teaser is actually older than the call to theme_print_node().
This needs a proper in-module fix.
Comment #4
jfrederick CreditAttribution: jfrederick commentedI am trying to figure out how to fix this, so I could submit my first patch. But what I don't understand, is what the teaser option should do.
Should the teaser option use the Print Build Mode, as it does now, or should it use the Teaser Build Mode?
As a solution, what is the downfall of simply axing
?
Comment #5
jfrederick CreditAttribution: jfrederick commentedHere is the patch I mentioned. How it affects use:
If you are sending e-mails as full nodes, everything remains the same.
If you are sending e-mails as teasers, your nodes will be templated by node.tpl.php, node-type.tpl.php, etc.
The D7 branch of Print already acts this way.
Thanks for the awesome module!
Comment #6
jcnventura CreditAttribution: jcnventura at Wunder commentedClosing all issues related to the Drupal 6 version of the print module.