You are here

protected function File::defaultDisplayOptions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/file/src/Plugin/views/wizard/File.php \Drupal\file\Plugin\views\wizard\File::defaultDisplayOptions()
  2. 10 core/modules/file/src/Plugin/views/wizard/File.php \Drupal\file\Plugin\views\wizard\File::defaultDisplayOptions()

Assembles the default display options for the view.

Most wizards will need to override this method to provide some fields or a different row plugin.

Return value

array Returns an array of display options.

Overrides WizardPluginBase::defaultDisplayOptions

File

core/modules/file/src/Plugin/views/wizard/File.php, line 28

Class

File
Tests creating managed files views with the wizard.

Namespace

Drupal\file\Plugin\views\wizard

Code

protected function defaultDisplayOptions() {
  $display_options = parent::defaultDisplayOptions();

  // Add permission-based access control.
  $display_options['access']['type'] = 'perm';

  // Remove the default fields, since we are customizing them here.
  unset($display_options['fields']);

  /* Field: File: Name */
  $display_options['fields']['filename']['id'] = 'filename';
  $display_options['fields']['filename']['table'] = 'file_managed';
  $display_options['fields']['filename']['field'] = 'filename';
  $display_options['fields']['filename']['entity_type'] = 'file';
  $display_options['fields']['filename']['entity_field'] = 'filename';
  $display_options['fields']['filename']['label'] = '';
  $display_options['fields']['filename']['alter']['alter_text'] = 0;
  $display_options['fields']['filename']['alter']['make_link'] = 0;
  $display_options['fields']['filename']['alter']['absolute'] = 0;
  $display_options['fields']['filename']['alter']['trim'] = 0;
  $display_options['fields']['filename']['alter']['word_boundary'] = 0;
  $display_options['fields']['filename']['alter']['ellipsis'] = 0;
  $display_options['fields']['filename']['alter']['strip_tags'] = 0;
  $display_options['fields']['filename']['alter']['html'] = 0;
  $display_options['fields']['filename']['hide_empty'] = 0;
  $display_options['fields']['filename']['empty_zero'] = 0;
  $display_options['fields']['filename']['plugin_id'] = 'field';
  $display_options['fields']['filename']['type'] = 'file_link';
  return $display_options;
}