diff --git a/page_manager/plugins/tasks/node_view.inc b/page_manager/plugins/tasks/node_view.inc index b8a7e0c..8f53751 100644 --- a/page_manager/plugins/tasks/node_view.inc +++ b/page_manager/plugins/tasks/node_view.inc @@ -78,6 +78,10 @@ function page_manager_node_view_menu_alter(&$items, $task) { * node view, which is node_page_view(). */ function page_manager_node_view_page($node) { + // Prep the node to be displayed so all of the regular hooks are triggered. + // Also save the output for later, in case it is needed. + $default_output = node_page_view($node); + // Load my task plugin $task = page_manager_get_task('node_view'); @@ -85,32 +89,26 @@ function page_manager_node_view_page($node) { ctools_include('context'); ctools_include('context-task-handler'); - // We need to mimic Drupal's behavior of setting the node title here. - drupal_set_title($node->title); - $uri = entity_uri('node', $node); - // Set the node path as the canonical URL to prevent duplicate content. - drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE); - // Set the non-aliased path as a default shortlink. - drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); + // Load all contexts. $contexts = ctools_context_handler_get_task_contexts($task, '', array($node)); + // Build the full output using the configured CTools plugin. $output = ctools_context_handler_render($task, '', $contexts, array($node->nid)); if ($output != FALSE) { node_tag_new($node); return $output; } - $function = 'node_page_view'; + // Try loading an override plugin. foreach (module_implements('page_manager_override') as $module) { $call = $module . '_page_manager_override'; if (($rc = $call('node_view')) && function_exists($rc)) { - $function = $rc; - break; + return $rc($node); } } - // Otherwise, fall back. - return $function($node); + // Otherwise, fall back to the default output generated by node_page_view(). + return $default_output; } /**