1 views_handler_field_file.inc | views_handler_field_file::render_link($data, $values) |
Render whatever the data is as a link to the file.
Data should be made XSS safe prior to calling this function.
File
- core/
modules/ file/ views/ views_handler_field_file.inc, line 63 - Definition of views_handler_field_file.
Class
- views_handler_field_file
- Field handler to provide simple renderer that allows linking to a file.
Code
function render_link($data, $values) {
if (!empty($this->options['link_to_file']) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
if ($this->options['link_to_file_options'] == 'download') {
$this->options['alter']['path'] = file_create_url($this->get_value($values, 'uri'));
}
else {
$this->options['alter']['path'] = 'file/' . $this->get_value($values, 'fid');
}
}
return $data;
}