00001 <?php 00002 00013 class views_handler_field_node_path extends views_handler_field { 00014 00015 function option_definition() { 00016 $options = parent::option_definition(); 00017 $options['absolute'] = array('default' => FALSE); 00018 00019 return $options; 00020 } 00021 00022 function construct() { 00023 parent::construct(); 00024 $this->additional_fields['nid'] = 'nid'; 00025 } 00026 00027 function options_form(&$form, &$form_state) { 00028 parent::options_form($form, $form_state); 00029 $form['absolute'] = array( 00030 '#type' => 'checkbox', 00031 '#title' => t('Use absolute link (begins with "http://")'), 00032 '#default_value' => $this->options['absolute'], 00033 '#description' => t('Enable this option to output an absolute link. Required if you want to use the path as a link destination (as in "output this field as a link" above).'), 00034 '#fieldset' => 'alter', 00035 ); 00036 } 00037 00038 function query() { 00039 $this->ensure_my_table(); 00040 $this->add_additional_fields(); 00041 } 00042 00043 function render($values) { 00044 $nid = $this->get_value($values, 'nid'); 00045 return url("node/$nid", array('absolute' => $this->options['absolute'])); 00046 } 00047 }