From ba96cffdb7d3f76254ff7391523a6fc34abf10e2 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 6 Apr 2010 19:49:03 +0000 Subject: - Patch #699440 by scor, effulgentsia, noahb, catch: add bundle support to entity_uri() callback to remove performance overhead of forum_url_outbound_alter(). --- modules/node/node.module | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'modules/node') diff --git a/modules/node/node.module b/modules/node/node.module index beaf71341..9bdcf0b65 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1340,7 +1340,9 @@ function template_preprocess_node(&$variables) { $variables['date'] = format_date($node->created); $variables['name'] = theme('username', array('account' => $node)); - $variables['node_url'] = url('node/' . $node->nid); + + $uri = entity_uri('node', $node); + $variables['node_url'] = url($uri['path'], $uri['options']); $variables['title'] = check_plain($node->title); $variables['page'] = node_is_page($node); @@ -1581,8 +1583,9 @@ function node_search_execute($keys = NULL) { $extra = module_invoke_all('node_search_result', $node); + $uri = entity_uri('node', $node); $results[] = array( - 'link' => url('node/' . $item->sid, array('absolute' => TRUE)), + 'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE))), 'type' => check_plain(node_type_get_name($node)), 'title' => $node->title, 'user' => theme('username', array('account' => $node)), @@ -2500,10 +2503,11 @@ function node_page_default() { */ function node_page_view($node) { 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('node/' . $node->nid)), TRUE); + 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('node/' . $node->nid, array('alias' => TRUE))), TRUE); + drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); return node_show($node); } -- cgit v1.2.3