function print_link_alter in Printer, email and PDF versions 5.x
Same name and namespace in other branches
- 5.4 print.module \print_link_alter()
- 5.2 print.module \print_link_alter()
- 5.3 print.module \print_link_alter()
- 6 print.module \print_link_alter()
Implementation of hook_link_alter().
File
- ./
print.module, line 319 - Displays Printer-friendly versions of Drupal pages.
Code
function print_link_alter(&$links, $node) {
foreach ($links as $module => $link) {
if (strpos($module, 'book_printer') !== FALSE) {
$print_html_book_link = variable_get('print_html_book_link', PRINT_HTML_BOOK_LINK_DEFAULT);
if ($print_html_book_link) {
$print_html_link_pos = variable_get('print_html_link_pos', array(
PRINT_HTML_LINK_POS_DEFAULT => PRINT_HTML_LINK_POS_DEFAULT,
));
if (!empty($print_html_link_pos['link'])) {
$format = theme('print_format_link');
switch ($print_html_book_link) {
case 1:
$path = $link['href'];
break;
case 2:
$print_html_link_use_alias = variable_get('print_html_link_use_alias', PRINT_HTML_LINK_USE_ALIAS_DEFAULT);
$path = $print_html_link_use_alias && isset($node->path) ? $node->path : $node->nid;
break;
}
$links[$module] = array(
'href' => PRINT_PATH . '/' . $path,
'title' => $format['text'],
'attributes' => $format['attributes'],
'html' => $format['html'],
);
}
else {
unset($links[$module]);
}
}
}
}
}