Hi,

I'm using your module in some drupal sites i have. Everytime i install a new module version, i have to tweak some things in print.module file for the module to accept my theme_print_link() function. (that's because i use an image instead of the label/text "print").

So, i would like to ask you to add the ability to theme the print links.
I suggest something like this in your print.module file:


function theme_print_link($node, $format, $query) {
  return array('href' => PRINT_PATH ."/". $node->nid,
               'title' => $format['text'],
               'attributes' => $format['attributes'],
               'query' => $query);
}

/**
 * Implementation of hook_link().
 */
function print_link($type, $node = NULL, $teaser = FALSE) {
   ....
   $links['print'] = theme('print_link', $node, $format, $query);
   ....
}

so that users may theme the print link.

I'm not an expert in coding for Drupal, so this was just a suggestion, maybe not the best one ;-)
Thank you for this great module!

Comments

jcnventura’s picture

Olá, Diana

Desculpa por tardar tanto a responder, mas será que me podes dizer qual a tua modificação? É que estava a pensar que fazer theming como me pedes não será muito produtivo.. O ideal talvez fosse permitir o theming da função print_format_link() que é a que realmente coloca os valores todos que talvez queiras alterar (o href e a query não são modificáveis, pelo que só mesmo o title e os attributes te podem interessar).

Saudações,

João

PS: Sorry to all non-Portuguese speakers. I promise not do it again.. Remember, babelfish is your friend.

jcnventura’s picture

Status: Active » Fixed

OK.

I got no answer back, but I think I understand what is needed. Theming the print_link function is not useful, as most code in there is not modifiable without breaking something important. Instead, I have opted to enable theming the print_format_link function which is the one with modifiable content (namely the link title and whether it is HTML or not).

For what you're asking, you should now theme the print_format_link function to use <img src="your img" /> as the text element of the returned array and TRUE as the html element. That would enable the use of an image for the link (I think).

Please tell me if this works for you.

Regards,

João

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.