diff --git a/ctools.module b/ctools.module index 8f1de3b..6f59568 100644 --- a/ctools.module +++ b/ctools.module @@ -617,20 +617,6 @@ function ctools_registry_files_alter(&$files, $indexed_modules) { return _ctools_registry_files_alter($files, $indexed_modules); } -/** - * Implements hook_entity_view(). - */ -function ctools_entity_view($entity, $type) { - // Track which entites have been "viewed" and have therefore had view hooks - // invoked for them. This info is used later by page manager to identify - // special cases where it needs to invoke view hooks manually. - $viewed_entities = &drupal_static(__FUNCTION__); - list($id, $rid, $bundle) = entity_extract_ids($type, $entity); - if ($id !== NULL) { - $viewed_entities[$type][$id] = $id; - } -} - // ----------------------------------------------------------------------- // CTools hook implementations. diff --git a/page_manager/plugins/tasks/node_view.inc b/page_manager/plugins/tasks/node_view.inc index 4808074..6b8ca6f 100644 --- a/page_manager/plugins/tasks/node_view.inc +++ b/page_manager/plugins/tasks/node_view.inc @@ -85,43 +85,35 @@ 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) { + $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); node_tag_new($node); - } - else { - // Otherwise try loading an override plugin with a node_page_view() - // fallback. - $function = 'node_page_view'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('node_view')) && function_exists($rc)) { - $function = $rc; - break; - } - } - $output = $function($node); + return $output; } - // Finally, we need to test if the entity view hooks were invoked for this - // node already, and invoke them manually if not. - $viewed_entities = drupal_static('ctools_entity_view'); - if (!isset($viewed_entities['node'][$node->nid])) { - node_show($node); // Quick way to invoke ALL view hooks. + // Otherwise try loading an override plugin with a node_page_view() + // fallback. + $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)) { + // Override page building callable. + $function = $rc; + break; + } } - return $output; + return $function($node); } /**