Commit a8feb742 authored by jcnventura's avatar jcnventura

Fix #481350: Don't show book link in links area when only that option is disabled

parent 90012f5b
......@@ -195,12 +195,15 @@ function print_block_view($delta = 0) {
/**
* Implementation of hook_link_alter().
*/
function print_link_alter(&$links, $node) {
function print_link_alter(array &$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) {
......@@ -219,6 +222,10 @@ function print_link_alter(&$links, $node) {
'attributes' => $format['attributes'],
'html' => $format['html'],
);
}
else {
unset($links[$module]);
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment