Commit 17691f50 authored by jcnventura's avatar jcnventura

Issue #1125842: use 'Print' view mode

parent 3b7d2c88
......@@ -505,18 +505,14 @@ function print_cck_extra_fields($type_name) {
}
/**
* Implements hook_field_build_modes().
* Implements hook_entity_info_alter().
*/
function print_field_build_modes() {
return array(
function print_entity_info_alter(&$info) {
// Add the 'Print' view mode for nodes.
$info['node']['view modes'] += array(
'print' => array(
'title' => t('Print'),
'build modes' => array(
'print' => array(
'title' => t('Print'),
'views style' => TRUE,
),
),
'label' => t('Print'),
'custom settings' => FALSE,
),
);
}
......
......@@ -481,9 +481,10 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
drupal_access_denied();
return FALSE;
}
$view_mode = $teaser ? 'teaser' : 'full';
drupal_set_title($node->title);
$view_mode = $teaser ? 'teaser' : 'print';
// Turn off Pagination by the Paging module
unset($node->pages);
unset($node->page_count);
......
......@@ -133,10 +133,10 @@ function print_mail_block_view($delta = 0) {
/**
* Implements hook_node_view().
*/
function print_mail_node_view($node, $build_mode) {
function print_mail_node_view($node, $view_mode) {
$print_mail_link_pos = variable_get('print_mail_link_pos', array(PRINT_MAIL_LINK_POS_DEFAULT => PRINT_MAIL_LINK_POS_DEFAULT));
$print_mail_link_use_alias = variable_get('print_mail_link_use_alias', PRINT_MAIL_LINK_USE_ALIAS_DEFAULT);
$allowed_type = print_mail_link_allowed(array('type' => 'node', 'node' => $node, 'teaser' => ($build_mode == 'teaser')));
$allowed_type = print_mail_link_allowed(array('type' => 'node', 'node' => $node, 'teaser' => ($view_mode == 'teaser')));
if (($allowed_type) && !empty($print_mail_link_pos['link'])) {
drupal_add_css(drupal_get_path('module', 'print') . '/css/printlinks.css');
$links = array();
......@@ -181,7 +181,7 @@ function print_mail_node_view($node, $build_mode) {
}
// Insert content corner links
if (!empty($print_mail_link_pos['corner']) && ($build_mode == 'full')) {
if (!empty($print_mail_link_pos['corner']) && ($view_mode == 'full')) {
$node->content['print_links']['#markup'] .= print_mail_insert_link(NULL, $node);
}
}
......
......@@ -236,10 +236,10 @@ function print_pdf_requirements($phase) {
/**
* Implements hook_node_view().
*/
function print_pdf_node_view($node, $build_mode) {
function print_pdf_node_view($node, $view_mode) {
$print_pdf_link_pos = variable_get('print_pdf_link_pos', array(PRINT_PDF_LINK_POS_DEFAULT => PRINT_PDF_LINK_POS_DEFAULT));
$print_pdf_link_use_alias = variable_get('print_pdf_link_use_alias', PRINT_PDF_LINK_USE_ALIAS_DEFAULT);
$allowed_type = print_pdf_link_allowed(array('type' => 'node', 'node' => $node, 'teaser' => ($build_mode == 'teaser')));
$allowed_type = print_pdf_link_allowed(array('type' => 'node', 'node' => $node, 'teaser' => ($view_mode == 'teaser')));
if (($allowed_type) && !empty($print_pdf_link_pos['link'])) {
drupal_add_css(drupal_get_path('module', 'print') . '/css/printlinks.css');
$links = array();
......@@ -283,7 +283,7 @@ function print_pdf_node_view($node, $build_mode) {
}
// Insert content corner links
if ((!empty($print_pdf_link_pos['corner'])) && ($build_mode == 'full')) {
if ((!empty($print_pdf_link_pos['corner'])) && ($view_mode == 'full')) {
$node->content['print_links']['#markup'] .= print_pdf_insert_link(NULL, $node);
}
}
......
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