Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291036

Search results' link should use the node's language to get the alias

$
0
0

API page: http://api.drupal.org/api/drupal/modules%21node%21node.module/function/n...

Using Drupal 7.18 (I think this is also an issue for 7.x-dev), with locale and i18n. I have setup nodes that are have two translations, English and Spanish. I've noticed the search results show Both the english node and the translated node. That is ok. The problem is that the translated node's path is not aliased according to it's language.

In node_search_execute, the following url() call does not pass in the node's language:

<?php
  $results
[] = array(
     
'link'=> url($uri['path'], array_merge($uri['options'], array('absolute'=> TRUE))),
?>

Should be something like:

<?php
  $results
[] = array(
     
'link'=> url($uri['path'], array_merge($uri['options'], array('absolute'=> TRUE, 'language'=> $node->language))),
?>

I haven't tested this code because I didn't want to patch core. Instead my work-around was to get the language appropriate alias using template_preprocess_search_result() and changing the templates.


Viewing all articles
Browse latest Browse all 291036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>