00001 <?php 00002 // $Id: views_handler_field_node_link.inc,v 1.1 2008/09/03 19:21:29 merlinofchaos Exp $ 00006 class views_handler_field_node_link extends views_handler_field { 00007 function construct() { 00008 parent::construct(); 00009 $this->additional_fields['nid'] = 'nid'; 00010 } 00011 00012 function option_definition() { 00013 $options = parent::option_definition(); 00014 00015 $options['text'] = array('default' => '', 'translatable' => TRUE); 00016 00017 return $options; 00018 } 00019 00020 function options_form(&$form, &$form_state) { 00021 parent::options_form($form, $form_state); 00022 $form['text'] = array( 00023 '#type' => 'textfield', 00024 '#title' => t('Text to display'), 00025 '#default_value' => $this->options['text'], 00026 ); 00027 } 00028 00029 function query() { 00030 $this->ensure_my_table(); 00031 $this->add_additional_fields(); 00032 } 00033 00034 function render($values) { 00035 $text = !empty($this->options['text']) ? $this->options['text'] : t('view'); 00036 $nid = $values->{$this->aliases['nid']}; 00037 return l($text, "node/$nid"); 00038 } 00039 }
1.4.7