| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/business/sites/all/modules/views/modules/system/ |
Upload File : |
<?php
/**
* @file
* Definition of views_handler_field_file_uri.
*/
/**
* Field handler to add rendering file paths as file URLs instead of as internal
* file URIs.
*/
class views_handler_field_file_uri extends views_handler_field_file {
/**
* {@inheritdoc}
*/
public function option_definition() {
$options = parent::option_definition();
$options['file_download_path'] = array('default' => FALSE, 'bool' => TRUE);
return $options;
}
/**
* {@inheritdoc}
*/
public function options_form(&$form, &$form_state) {
$form['file_download_path'] = array(
'#title' => t('Display download path instead of file storage URI'),
'#description' => t('This will provide the full download URL rather than the internal filestream address.'),
'#type' => 'checkbox',
'#default_value' => !empty($this->options['file_download_path']),
);
parent::options_form($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function render($values) {
$data = $values->{$this->field_alias};
if (!empty($this->options['file_download_path']) && $data !== NULL && $data !== '') {
$data = file_create_url($data);
}
return $this->render_link($data, $values);
}
}