You are here

public function FileName::init in File Entity (fieldable files) 8.2

Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().

Overrides FieldPluginBase::init

File

src/Plugin/views/field/FileName.php, line 24

Class

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

Namespace

Drupal\file_entity\Plugin\views\field

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);

  // Don't add the additional fields to groupby
  if (!empty($this->options['link_to_file'])) {
    $this->additional_fields['fid'] = array(
      'table' => 'file_managed',
      'field' => 'fid',
    );
  }
}