00001 <?php 00002 00006 class views_handler_field_file_uri extends views_handler_field_file { 00007 function option_definition() { 00008 $options = parent::option_definition(); 00009 $options['file_download_path'] = array('default' => FALSE); 00010 return $options; 00011 } 00012 00013 function options_form(&$form, &$form_state) { 00014 $form['file_download_path'] = array( 00015 '#title' => t('Display download path instead of file storage URI'), 00016 '#description' => t('This will provide the full download URL rather than the internal filestream address.'), 00017 '#type' => 'checkbox', 00018 '#default_value' => !empty($this->options['file_download_path']), 00019 ); 00020 parent::options_form($form, $form_state); 00021 } 00022 00023 function render($values) { 00024 $data = $values->{$this->field_alias}; 00025 if (!empty($this->options['file_download_path']) && $data !== NULL && $data !== '') { 00026 $data = file_create_url($data); 00027 } 00028 return $this->render_link($data, $values); 00029 } 00030 }