function page_manager_node_view_page in Chaos Tool Suite (ctools) 7
Entry point for our overridden node view.
This function asks its assigned handlers who, if anyone, would like to run with it. If no one does, it passes through to Drupal core's node view, which is node_page_view().
2 string references to 'page_manager_node_view_page'
- page_manager_menu_alter in page_manager/
page_manager.module - Implements hook_menu_alter.
- page_manager_node_view_menu_alter in page_manager/
plugins/ tasks/ node_view.inc - Callback defined by page_manager_node_view_page_manager_tasks().
File
- page_manager/
plugins/ tasks/ node_view.inc, line 80 - Handle the 'node view' override task.
Code
function page_manager_node_view_page($node) {
// Load my task plugin.
$task = page_manager_get_task('node_view');
// Load the node into a context.
ctools_include('context');
ctools_include('context-task-handler');
$uri = entity_uri('node', $node);
if (isset($uri['path'])) {
// Set the node path as the canonical URL to prevent duplicate content.
$meta_canon = array(
'rel' => 'canonical',
'href' => url($uri['path'], $uri['options']),
);
drupal_add_html_head_link($meta_canon, TRUE);
// Set the non-aliased path as a default shortlink.
$meta_short = array(
'rel' => 'shortlink',
'href' => url($uri['path'], array_merge($uri['options'], array(
'alias' => TRUE,
))),
);
drupal_add_html_head_link($meta_short, 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;
}
// 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)) {
return $rc($node);
}
}
// Prepare the node to be displayed so all of the regular hooks are triggered.
$default_output = node_page_view($node);
// Otherwise, fall back to the default output generated by node_page_view().
return $default_output;
}