Commit 2ed88c94 authored by merlinofchaos's avatar merlinofchaos

#564536 by dereine: Node links should allow language setting from node data.

parent fe8740a1
......@@ -43,6 +43,7 @@ Views 2.x-dev
o #523222 by gpk: Contact link should not be allowed for the anonymous user.
o #563540 by dereine: Fix description of cache plugin settings.
o #563564 by dereine: Unformatted style does not use options, so the options icon should not appear.
o #564536 by dereine: Node links should allow language setting from node data.
Other changes:
o Implement a post_render hook (for themes too) and cache method.
......
......@@ -619,6 +619,9 @@ class views_handler_field extends views_handler {
if (isset($alter['fragment'])) {
$options['fragment'] = strtr($alter['fragment'], $tokens);
}
if (isset($this->options['alter']['language'])) {
$options['language'] = $this->options['alter']['language'];
}
$value .= l($text, $path, $options);
......
......@@ -15,6 +15,9 @@ class views_handler_field_node extends views_handler_field {
function construct() {
parent::construct();
$this->additional_fields['nid'] = 'nid';
if (module_exists('translation')) {
$this->additional_fields['language'] = array('table' => 'node', 'field' => 'language');
}
}
function option_definition() {
......@@ -45,6 +48,10 @@ class views_handler_field_node extends views_handler_field {
if (!empty($this->options['link_to_node']) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "node/" . $values->{$this->aliases['nid']};
if (isset($this->aliases['language'])) {
$languages = language_list();
$this->options['alter']['language'] = $languages[$values->{$this->aliases['language']}];
}
}
return $data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment