Commit 6f47a725 authored by jcnventura's avatar jcnventura

Initial support to print-specific node template (thanks pixelmord).

parent e56fb43d
......@@ -111,7 +111,7 @@ function print_theme() {
'variables' => array(),
),
'print_node' => array(
'variables' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE, 'type' => PRINT_HTML_FORMAT),
'render element' => 'elements',
'template' => 'print_node',
),
'print' => array(
......@@ -149,16 +149,13 @@ function print_preprocess_print_node(&$variables) {
}
}
$variables['node'] = $variables['elements']['#node'];
$type = $variables['node']->type;
$format = $variables['type'];
// template_preprocess_node($variables);
$type = $variables['elements']['#node']->type;
$format = $variables['elements']['#print_format'];
$variables['theme_hook_suggestions'][] = "node";
$variables['theme_hook_suggestions'][] = "node__{$type}";
$variables['theme_hook_suggestions'][] = "print_node";
// $variables['theme_hook_suggestions'][] = "print_node_{$format}";
// $variables['theme_hook_suggestions'][] = "print_node_{$format}.node__{$type}";
$variables['theme_hook_suggestions'][] = "print_node_{$format}";
$variables['theme_hook_suggestions'][] = "print_node_{$format}.node__{$type}";
}
/**
......@@ -900,7 +897,7 @@ function print_link_allowed($args) {
/**
* Parse an array into a valid urlencoded query string.
* Modified from drupal_query_string_encode to prevent re-encoding of
* encoded original.
* encoded original. (see #301192)
*
* @param $query
* The array to be processed e.g. $_GET
......
......@@ -554,10 +554,11 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
}
$build += array(
'#theme' => 'node',
'#theme' => 'print_node',
'#node' => $node,
'#view_mode' => $view_mode,
'#language' => $langcode,
'#print_format' => $format,
);
$type = 'node';
......@@ -565,10 +566,6 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
$content = render($build);
//Get rid of the annoying D7 title link
$pattern = '!(<h2 property="dc:title" datatype="">)\s*<a [^>]*?>(.*?)</a>\s*(</h2>)!mis';
$content = preg_replace($pattern, '$1$2$3', $content);
//Check URL list settings
$_print_urls = _print_url_list_enabled($node, $format);
......
......@@ -28,6 +28,7 @@
<p />
<div class="print-breadcrumb"><?php print $print['breadcrumb']; ?></div>
<hr class="print-hr" />
<h1 class="print-title"><?php print $print['title']; ?></h1>
<div class="print-content"><?php print $print['content']; ?></div>
<div class="print-footer"><?php print $print['footer_message']; ?></div>
<hr class="print-hr" />
......
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