function File::init

Same name and namespace in other branches
  1. 9 core/modules/file/src/Plugin/views/field/File.php \Drupal\file\Plugin\views\field\File::init()
  2. 8.9.x core/modules/file/src/Plugin/views/field/File.php \Drupal\file\Plugin\views\field\File::init()
  3. 10 core/modules/file/src/Plugin/views/field/File.php \Drupal\file\Plugin\views\field\File::init()

Overrides FieldPluginBase::init

File

core/modules/file/src/Plugin/views/field/File.php, line 56

Class

File
Field handler to provide simple renderer that allows linking to a file.

Namespace

Drupal\file\Plugin\views\field

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
    parent::init($view, $display, $options);
    if (!empty($options['link_to_file'])) {
        $this->additional_fields['uri'] = 'uri';
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.