diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-04-06 19:49:03 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-04-06 19:49:03 +0000 |
commit | ba96cffdb7d3f76254ff7391523a6fc34abf10e2 (patch) | |
tree | dd42dc052efda70657a1e73ab1e47964c920d734 /modules/node | |
parent | c2b1029595afe103b5f1533604cfe658755f1f8d (diff) | |
download | brdo-ba96cffdb7d3f76254ff7391523a6fc34abf10e2.tar.gz brdo-ba96cffdb7d3f76254ff7391523a6fc34abf10e2.tar.bz2 |
- Patch #699440 by scor, effulgentsia, noahb, catch: add bundle support to entity_uri() callback to remove performance overhead of forum_url_outbound_alter().
Diffstat (limited to 'modules/node')
-rw-r--r-- | modules/node/node.module | 12 |
1 files changed, 8 insertions, 4 deletions
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); } |