protected function File::renderLink in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Plugin/views/field/File.php \Drupal\file\Plugin\views\field\File::renderLink()
Prepares link to the file.
Parameters
string $data: The XSS safe string for the link text.
\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.
Return value
string Returns a string for the link text.
1 call to File::renderLink()
- File::render in core/
modules/ file/ src/ Plugin/ views/ field/ File.php - Renders the field.
File
- core/
modules/ file/ src/ Plugin/ views/ field/ File.php, line 69 - Contains \Drupal\file\Plugin\views\field\File.
Class
- File
- Field handler to provide simple renderer that allows linking to a file.
Namespace
Drupal\file\Plugin\views\fieldCode
protected function renderLink($data, ResultRow $values) {
if (!empty($this->options['link_to_file']) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = file_create_url($this
->getValue($values, 'uri'));
}
return $data;
}