commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / views / modules / translation / views_handler_field_node_link_translate.inc
1 <?php
2
3 /**
4 * @file
5 * Definition of views_handler_field_node_link_translate.
6 */
7
8 /**
9 * Field handler to present a link node translate.
10 *
11 * @ingroup views_field_handlers
12 */
13 class views_handler_field_node_link_translate extends views_handler_field_node_link {
14 function render_link($data, $values) {
15 // ensure user has access to edit this node.
16 $node = $this->get_value($values);
17 $node->status = 1; // unpublished nodes ignore access control
18 if (empty($node->language) || !translation_supported_type($node->type) || !node_access('view', $node) || !user_access('translate content')) {
19 return;
20 }
21
22 $this->options['alter']['make_link'] = TRUE;
23 $this->options['alter']['path'] = "node/$node->nid/translate";
24 $this->options['alter']['query'] = drupal_get_destination();
25
26 $text = !empty($this->options['text']) ? $this->options['text'] : t('translate');
27 return $text;
28 }
29 }