function RssPluginBase::defineOptions

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/row/RssPluginBase.php \Drupal\views\Plugin\views\row\RssPluginBase::defineOptions()
  2. 10 core/modules/views/src/Plugin/views/row/RssPluginBase.php \Drupal\views\Plugin\views\row\RssPluginBase::defineOptions()
  3. 9 core/modules/views/src/Plugin/views/row/RssPluginBase.php \Drupal\views\Plugin\views\row\RssPluginBase::defineOptions()
  4. 8.9.x core/modules/views/src/Plugin/views/row/RssPluginBase.php \Drupal\views\Plugin\views\row\RssPluginBase::defineOptions()

Overrides RowPluginBase::defineOptions

File

core/modules/views/src/Plugin/views/row/RssPluginBase.php, line 64

Class

RssPluginBase
Base class for Views RSS row plugins.

Namespace

Drupal\views\Plugin\views\row

Code

protected function defineOptions() {
  $options = parent::defineOptions();
  // Select the rss view mode by default, otherwise select the first available
  // view mode.
  $view_modes = $this->entityDisplayRepository
    ->getViewModes($this->entityTypeId);
  if (isset($view_modes['rss'])) {
    $options['view_mode'] = [
      'default' => 'rss',
    ];
  }
  else {
    $options['view_mode'] = [
      'default' => key($view_modes),
    ];
  }
  return $options;
}

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