Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Rather than having the current setup of text being added in variables in a closed function in the module, can we have a theme function so we can override the text in the print pages? I can't work this out myself easily to apply a patch unfortunately though...
Comments
Comment #1
jcnventura CreditAttribution: jcnventura commentedThis is actually been done already, but not yet in the 'official' release.
You can now theme the print_format_link, which enables you to change the contents of the link array. To replace the link text, replace the 'text' field with whatever you want.
Comment #2
NikLP CreditAttribution: NikLP commentedI was thinking more of the other stuff, like "By !user" etc. "By" shouldn't really be capitalised, and other than that, we ought to be able to override all this stuff. Anything that outputs text or markup should really be themable, although I don't want to be too patronising :)
Comment #3
jcnventura CreditAttribution: jcnventura commentedOK. Sorry for the misunderstanding...
As to your request, my suggestion is to use the super-theming capability which involves placing a copy of the print.tpl.php file in your current theme folder. You can then do whatever you want with the layout and content of the print output page (including removing or replacing the text provided by the default functionality). Would this suit your purposes?
I actually removed the 'By' from the template file a while ago, as I wanted that file to be very simple and easy to edit. I could move back there the 'By', 'Created', 'retrieved on' and 'Published on', but that would clutter the file and I guess most people who don't like the text usually prefer to completely remove the line.
Regards,
João
Comment #4
NikLP CreditAttribution: NikLP commentedI have used the facility of the template file; however, my point really relates to the fact that you are creating the "theme" variables in a function, and those variables contain text. It would be better if the variables were created in a function of their own (no text) and then returned from a separate theming function that could contain all the non-generated text. Alternatively, you could just remove the text from the variables altogether and print the text in the template, but that would mean they couldn't be translated by t().
In the way that I'm describing, the level of flexibility is dramatically increased, and no-one needs to install translation modules to change the text :)
Thanks for sticking with me on this :)
Comment #5
jcnventura CreditAttribution: jcnventura commentedI see your point.. I think I can do this in the next version (I have just released 5.x-3.1, so it will probably be 5.x-3.2).
Comment #6
jcnventura CreditAttribution: jcnventura commentedOk.
I have just added a function called theme_print_text which you can costumize to change the string via the theme.
I tested it and it is OK for me, but tell me if there's any problem.
João
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #8
haggins CreditAttribution: haggins commentedmytheme_print_text() doesn't do anything at my template.php
I also can't find this function defined at any of the modules files. Could you describe a little more precise how to change the variables values for print.tpl.php or even how to add additional vars?
Thanks in advance.
Comment #9
jcnventura CreditAttribution: jcnventura commentedThe theme_print_text() function was removed in 6.x-1.0 (December 2008), in favor of letting the users change that text in the settings UI.
Comment #10
haggins CreditAttribution: haggins commentedSo there is no chance to add any information (i.e. context) to print.tpl.php?
It's a pity :(
Comment #11
jcnventura CreditAttribution: jcnventura commentedWell the print.tpl.php file is a PHP file, you can do anything there.. You have access to the node object in $node..
I don't really understand what you mean with "context".
Comment #12
jcnventura CreditAttribution: jcnventura commentedNo further info in more than two weeks. Closing the issue.