I have a few issues I am dealing with since enabling the (very nicely constructed) print module to do a simple "print this page" (not a pdf)
Note that I have placed these issues is separate posts.
Preface: I have a correctly configured and enabled a "helper module" for dealing with these issues. I also have a .tpl file print_html.node-activity.tpl.php in the same directory that (at the moment) is the same as the print.tpl file.
This post concerns the following:
I cannot seem to get the MYMODULE_print_manager_print_format_link() to work with my module that controls this functionality. At the moment, all I want to do is add a custom wrapper to the link using '#prefix' and '#suffix' .
Here is the code I inserted to wrap the links - - using the theme_print_manager_print_format_link()
function MYMODULE_print_manager_print_format_link() {
//Note that this section is included "as-is" in the print.module
$print_html_link_class = variable_get('print_html_link_class', PRINT_HTML_LINK_CLASS_DEFAULT);
$print_html_new_window = variable_get('print_html_new_window', PRINT_HTML_NEW_WINDOW_DEFAULT);
$print_html_show_link = variable_get('print_html_show_link', PRINT_HTML_SHOW_LINK_DEFAULT);
$print_html_link_text = filter_xss(variable_get('print_html_link_text', t('Printer-friendly version')));
$img = drupal_get_path('module', 'print') .'/icons/print_icon.gif';
$title = 'print this activity';
$class = strip_tags($print_html_link_class);
$new_window = $print_html_new_window;
$format = _print_format_link_aux($print_html_show_link, $print_html_link_text, $img);
//Note that I added the prefix/suffix
return array(
'text' => $format['text'],
'html' => $format['html'],
'attributes' => print_fill_attributes($title, $class, $new_window),
'#prefix' => '<span class = "print-link-wrapper">',
'#suffix' => '</span>'
);
}
It is not seeing the wrapper called for by the prefix/suffix- - is this n
Note that my hook_perm and hook_init work correctly but this function does not seem to matter
This is what is returned via dpr($node->links['print_html'])):
Array
(
[href] => print/8
[title] => print this activity
[attributes] => Array
(
[title] => Display a printer-friendly version of this page.
[class] => print-page node-text-orange
[rel] => nofollow
)
[html] =>
[query] =>
)
So - - 2 questions:
1) why cannot I not seem to use the print_insert_link() function (pre my comment below)
2) why can I not insert the prefix and suffix to this link?
Thanks to all
Comments
Comment #1
jcnventuraI think the problem may be that your function is called MODULE_print_manager_print_format_link(). The hook is called theme_print_format_link() so to use it the function should be called MYMODULE_print_format_link().
Other than this, I can't imagine what else can be wrong.
Comment #2
avpadernoIn Drupal 6, each theme function must be declared through
hook_theme().Comment #3
jcnventuraNo further info in two weeks. Closing the issue.