diff --git a/page_manager/plugins/tasks/node_view.inc b/page_manager/plugins/tasks/node_view.inc index 6b8ca6f..f0500df 100644 --- a/page_manager/plugins/tasks/node_view.inc +++ b/page_manager/plugins/tasks/node_view.inc @@ -100,8 +100,7 @@ function page_manager_node_view_page($node) { return $output; } - // Otherwise try loading an override plugin with a node_page_view() - // fallback. + // 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) { diff --git a/page_manager/plugins/tasks/term_view.inc b/page_manager/plugins/tasks/term_view.inc index 37259b9..e5c23cf 100644 --- a/page_manager/plugins/tasks/term_view.inc +++ b/page_manager/plugins/tasks/term_view.inc @@ -107,28 +107,6 @@ function page_manager_term_view_menu_alter(&$items, $task) { * term view, which is term_page_view(). */ function page_manager_term_view_page($term, $depth = NULL) { - // Prep the term to be displayed so all of the regular hooks are triggered. - // Rather than calling taxonomy_term_page() directly, as it that would - // potentially load nodes that were not necessary, execute some of the code - // prior to identifying the correct CTools or Page Manager task handler and - // only proceed with the rest of the code if necessary. - - // Assign the term name as the page title. - drupal_set_title($term->name); - - // If there is a menu link to this term, the link becomes the last part - // of the active trail, and the link name becomes the page title. - // Thus, we must explicitly set the page title to be the node title. - $uri = entity_uri('taxonomy_term', $term); - - // Set the term 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); - - // Trigger the main - $build = taxonomy_term_show($term); - // Load my task plugin $task = page_manager_get_task('term_view'); @@ -144,6 +122,16 @@ function page_manager_term_view_page($term, $depth = NULL) { // Build the full output using the configured CTools plugin. $output = ctools_context_handler_render($task, '', $contexts, array($term->tid)); if ($output !== FALSE) { + // If there is a menu link to this term, the link becomes the last part + // of the active trail, and the link name becomes the page title. + // Thus, we must explicitly set the page title to be the node title. + $uri = entity_uri('taxonomy_term', $term); + + // Set the term 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); + return $output; } @@ -155,41 +143,9 @@ function page_manager_term_view_page($term, $depth = NULL) { } } - // Otherwise, fall back to replicating the output normally generated by - // taxonomy_term_page(). - - // Build breadcrumb based on the hierarchy of the term. - $current = (object) array( - 'tid' => $term->tid, - ); - // @todo This overrides any other possible breadcrumb and is a pure hard-coded - // presumption. Make this behavior configurable per vocabulary or term. - $breadcrumb = array(); - while ($parents = taxonomy_get_parents($current->tid)) { - $current = array_shift($parents); - $breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid); - } - $breadcrumb[] = l(t('Home'), NULL); - $breadcrumb = array_reverse($breadcrumb); - drupal_set_breadcrumb($breadcrumb); - drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name); - - if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) { - $nodes = node_load_multiple($nids); - $build += node_view_multiple($nodes); - $build['pager'] = array( - '#theme' => 'pager', - '#weight' => 5, - ); - } - else { - $build['no_content'] = array( - '#prefix' => '

', - '#markup' => t('There is currently no content classified with this term.'), - '#suffix' => '

', - ); - } - return $build; + // Otherwise, fall back to taxonomy_term_page(). + module_load_include('inc', 'taxonomy', 'taxonomy.pages'); + return taxonomy_term_page($term); } /** diff --git a/page_manager/plugins/tasks/user_view.inc b/page_manager/plugins/tasks/user_view.inc index c428384..56a3ac9 100644 --- a/page_manager/plugins/tasks/user_view.inc +++ b/page_manager/plugins/tasks/user_view.inc @@ -69,7 +69,7 @@ function page_manager_user_view_menu_alter(&$items, $task) { * user view, which is user_page_view(). */ function page_manager_user_view_page($account) { - // Load my task plugin: + // Load my task plugin. $task = page_manager_get_task('user_view'); // Load the account into a context. @@ -77,14 +77,12 @@ function page_manager_user_view_page($account) { ctools_include('context-task-handler'); $contexts = ctools_context_handler_get_task_contexts($task, '', array($account)); - // Build content. @todo -- this may not be right. - user_build_content($account); - $output = ctools_context_handler_render($task, '', $contexts, array($account->uid)); if ($output !== FALSE) { return $output; } + // Otherwise try loading an override plugin with a user_view() fallback. $function = 'user_view'; foreach (module_implements('page_manager_override') as $module) { $call = $module . '_page_manager_override'; @@ -94,14 +92,6 @@ function page_manager_user_view_page($account) { } } - // Otherwise, fall back. - if ($function == 'user_view') { - module_load_include('inc', 'user', 'user.pages'); - } - //fire off "view" op so that triggers still work - // @todo -- this doesn't work anymore, and the alternatives seem bad. - // will have to figure out how to fix this. -// user_module_invoke('view', $array = array(), $account); return $function($account); }