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) { ...@@ -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 // Insert content corner links
$node->content['print_links'] = array( $node->content['print_links'] = array(
'#markup' => "<span class='print-link'></span>", '#markup' => "<span class='print-link'></span>",
'#weight' => -101, '#weight' => -101,
); );
if (($teaser === FALSE) && !empty($print_html_link_pos['corner']) && if (!empty($print_html_link_pos['corner'])) {
isset($node->build_mode) && ($node->build_mode == NODE_BUILD_NORMAL)) {
$link = print_insert_link(NULL, $node); $link = print_insert_link(NULL, $node);
if ($link) { if ($link) {
$node->content['print_links']['#markup'] = preg_replace('!</span>$!', $link . '</span>', $node->content['print_links']['#markup']); $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) { ...@@ -397,6 +398,23 @@ function print_cck_extra_fields($type_name) {
return $fields; 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 * 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 ...@@ -574,6 +574,8 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
// Adapted (simplified) version of node_view // Adapted (simplified) version of node_view
//Render the node content //Render the node content
$node = node_build_content($node, $teaser, TRUE); $node = node_build_content($node, $teaser, TRUE);
// Disable the links area
unset($node->content['links']);
// Disable fivestar widget output // Disable fivestar widget output
unset($node->content['fivestar_widget']); unset($node->content['fivestar_widget']);
// Disable service links module output // Disable service links module output
...@@ -619,7 +621,7 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t ...@@ -619,7 +621,7 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
} }
$node->body .= $comments; $node->body .= $comments;
} }
node_invoke_node($node, 'alter', $teaser, TRUE); module_invoke_all('node_alter', $node, $teaser, TRUE);
if ($teaser) { if ($teaser) {
$node->body = $node->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