function print_ui_block_view in Printer, email and PDF versions 7.2
Implements hook_block_view().
File
- print_ui/
print_ui.module, line 85 - Printer-friendly pages User Interface module.
Code
function print_ui_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'print-links':
$nid = preg_replace('!^node/!', '', $_GET['q']);
if (ctype_digit($nid)) {
$node = node_load($nid);
if (!node_access('view', $node)) {
// If the user doesn't have access to the node, don't show any links.
$block['content'] = '';
return array();
}
}
else {
$node = NULL;
}
$block['content'] = '';
foreach (module_implements('print_link') as $module) {
$function = $module . '_print_link';
if (function_exists($function)) {
$link = call_user_func_array($function, array());
$link_pos = variable_get('print_' . $link['format'] . '_link_pos', drupal_json_decode(PRINT_UI_LINK_POS_DEFAULT));
if (!empty($link_pos['block'])) {
$links = print_ui_insert_link($link, array(
'node' => $node,
'location' => 'block',
));
if (!empty($links)) {
$block['content'] .= $links;
}
}
}
}
break;
}
return $block;
}