You are here

protected function DataExport::defineOptions in Views data export 8

Same name in this branch
  1. 8 src/Plugin/views/display/DataExport.php \Drupal\views_data_export\Plugin\views\display\DataExport::defineOptions()
  2. 8 src/Plugin/views/style/DataExport.php \Drupal\views_data_export\Plugin\views\style\DataExport::defineOptions()

Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase:defineOptions().

Overrides RestExport::defineOptions

File

src/Plugin/views/display/DataExport.php, line 197

Class

DataExport
Provides a data export display plugin.

Namespace

Drupal\views_data_export\Plugin\views\display

Code

protected function defineOptions() {
  $options = parent::defineOptions();
  $options['displays'] = [
    'default' => [],
  ];

  // Set the default style plugin, and default to fields.
  $options['style']['contains']['type']['default'] = 'data_export';
  $options['row']['contains']['type']['default'] = 'data_field';

  // We don't want to use pager as it doesn't make any sense. But it cannot
  // just be removed from a view as it is core functionality. These values
  // will be controlled by custom configuration.
  $options['pager']['contains'] = [
    'type' => [
      'default' => 'none',
    ],
    'options' => [
      'default' => [
        'offset' => 0,
      ],
    ],
  ];
  $options['export_method']['default'] = 'standard';
  $options['export_batch_size']['default'] = '1000';
  $options['export_limit']['default'] = '0';

  // Set facet source default.
  if (\Drupal::service('module_handler')
    ->moduleExists('facets')) {
    $options['facet_settings']['default'] = 'none';
  }

  // Set download, file storage and redirect defaults.
  $options['automatic_download']['default'] = FALSE;
  $options['store_in_public_file_directory']['default'] = FALSE;
  $options['custom_redirect_path']['default'] = FALSE;

  // Redirect to views display option.
  $options['redirect_to_display']['default'] = 'none';
  return $options;
}