summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2009-09-21 21:34:07 (GMT)
committer Earl Miles2009-09-21 21:34:07 (GMT)
commit2ed88c940009ed8c7ad01f1ffbb836c5b95ee192 (patch)
treeda0e09e9f5fce254a2ccb68442ef3e02623ae588
parentfe8740a1814704a08cefd0f6316b6bd12a54130d (diff)
#564536 by dereine: Node links should allow language setting from node data.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--handlers/views_handler_field.inc3
-rw-r--r--modules/node/views_handler_field_node.inc7
3 files changed, 11 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 5e360b9..3729c53 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -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.
diff --git a/handlers/views_handler_field.inc b/handlers/views_handler_field.inc
index 097dc53..d74a1a4 100644
--- a/handlers/views_handler_field.inc
+++ b/handlers/views_handler_field.inc
@@ -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);
diff --git a/modules/node/views_handler_field_node.inc b/modules/node/views_handler_field_node.inc
index 38551d1..cd80f0c 100644
--- a/modules/node/views_handler_field_node.inc
+++ b/modules/node/views_handler_field_node.inc
@@ -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;
}