Commit a924eea7 authored by jcnventura's avatar jcnventura

Disable corner link span when empty

Add CCK's print_cck_build_modes hook
Update module to Drupal 7 current code
parent e522c3f2
......@@ -293,18 +293,19 @@ function print_node_view($node, $teaser) {
);
}
if (($teaser === FALSE) && isset($node->build_mode) && ($node->build_mode == NODE_BUILD_NORMAL)) {
// Insert content corner links
$node->content['print_links'] = array(
'#markup' => "<span class='print-link'></span>",
'#weight' => -101,
);
if (($teaser === FALSE) && !empty($print_html_link_pos['corner']) &&
isset($node->build_mode) && ($node->build_mode == NODE_BUILD_NORMAL)) {
if (!empty($print_html_link_pos['corner'])) {
$link = print_insert_link(NULL, $node);
if ($link) {
$node->content['print_links']['#markup'] = preg_replace('!</span>$!', $link . '</span>', $node->content['print_links']['#markup']);
}
}
}
}
/**
......@@ -397,6 +398,23 @@ function print_cck_extra_fields($type_name) {
return $fields;
}
/**
* Implementation of hook_cck_build_modes().
*/
function print_cck_build_modes() {
return array(
'print' => array(
'title' => t('Print'),
'build modes' => array(
NODE_BUILD_PRINT => array(
'title' => t('Print'),
'views style' => TRUE,
),
),
),
);
}
/**
* Auxiliary function to assign the per-node settings to the node object fields
*
......
......@@ -574,6 +574,8 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
// Adapted (simplified) version of node_view
//Render the node content
$node = node_build_content($node, $teaser, TRUE);
// Disable the links area
unset($node->content['links']);
// Disable fivestar widget output
unset($node->content['fivestar_widget']);
// Disable service links module output
......@@ -619,7 +621,7 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
}
$node->body .= $comments;
}
node_invoke_node($node, 'alter', $teaser, TRUE);
module_invoke_all('node_alter', $node, $teaser, TRUE);
if ($teaser) {
$node->body = $node->teaser;
......
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