diff --git a/core/modules/views/src/Plugin/views/display/Feed.php b/core/modules/views/src/Plugin/views/display/Feed.php index 9fa0642..747e3f5 100644 --- a/core/modules/views/src/Plugin/views/display/Feed.php +++ b/core/modules/views/src/Plugin/views/display/Feed.php @@ -126,7 +126,7 @@ protected function defineOptions() { $options['style']['contains']['type']['default'] = 'rss'; $options['style']['contains']['options']['default'] = array('description' => ''); $options['sitename_title']['default'] = FALSE; - $options['row']['contains']['type']['default'] = ''; + $options['row']['contains']['type']['default'] = 'rss_fields'; $options['defaults']['default']['style'] = FALSE; $options['defaults']['default']['row'] = FALSE; @@ -134,6 +134,24 @@ protected function defineOptions() { } /** + * {@inheritdoc} + */ + public function newDisplay() { + parent::newDisplay(); + + // Set the default row style. Ideally this would be part of the option + // definition, but in this case it's dependent on the view's base table, + // which we don't know until init(). + $row_plugins = Views::fetchPluginNames('row', $this->getType(), array($this->view->storage->get('base_table'))); + $default_row_plugin = key($row_plugins); + if (empty($this->options['row']['type']) || $this->options['row']['type'] === 'rss_fields') { + $options = $this->getOption('row'); + $options['type'] = $default_row_plugin; + $this->setOption('row', $options); + } + } + + /** * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary(). */ public function optionsSummary(&$categories, &$options) {