Révision e4c061ad
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/node_view.inc | ||
---|---|---|
78 | 78 |
* node view, which is node_page_view(). |
79 | 79 |
*/ |
80 | 80 |
function page_manager_node_view_page($node) { |
81 |
// Prep the node to be displayed so all of the regular hooks are triggered. |
|
82 |
// Also save the output for later, in case it is needed. |
|
83 |
$default_output = node_page_view($node); |
|
84 |
|
|
81 | 85 |
// Load my task plugin |
82 | 86 |
$task = page_manager_get_task('node_view'); |
83 | 87 |
|
... | ... | |
85 | 89 |
ctools_include('context'); |
86 | 90 |
ctools_include('context-task-handler'); |
87 | 91 |
|
88 |
// We need to mimic Drupal's behavior of setting the node title here. |
|
89 |
drupal_set_title($node->title); |
|
90 |
$uri = entity_uri('node', $node); |
|
91 |
// Set the node path as the canonical URL to prevent duplicate content. |
|
92 |
drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE); |
|
93 |
// Set the non-aliased path as a default shortlink. |
|
94 |
drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); |
|
92 |
// Load all contexts. |
|
95 | 93 |
$contexts = ctools_context_handler_get_task_contexts($task, '', array($node)); |
96 | 94 |
|
95 |
// Build the full output using the configured CTools plugin. |
|
97 | 96 |
$output = ctools_context_handler_render($task, '', $contexts, array($node->nid)); |
98 |
if ($output != FALSE) { |
|
97 |
if ($output !== FALSE) {
|
|
99 | 98 |
node_tag_new($node); |
100 | 99 |
return $output; |
101 | 100 |
} |
102 | 101 |
|
103 |
$function = 'node_page_view';
|
|
102 |
// Try loading an override plugin.
|
|
104 | 103 |
foreach (module_implements('page_manager_override') as $module) { |
105 | 104 |
$call = $module . '_page_manager_override'; |
106 | 105 |
if (($rc = $call('node_view')) && function_exists($rc)) { |
107 |
$function = $rc; |
|
108 |
break; |
|
106 |
return $rc($node); |
|
109 | 107 |
} |
110 | 108 |
} |
111 | 109 |
|
112 |
// Otherwise, fall back. |
|
113 |
return $function($node);
|
|
110 |
// Otherwise, fall back to the default output generated by node_page_view().
|
|
111 |
return $default_output;
|
|
114 | 112 |
} |
115 | 113 |
|
116 | 114 |
/** |
Formats disponibles : Unified diff
Weekly update of contrib modules