function Feed::newDisplay

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::newDisplay()
  2. 10 core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::newDisplay()
  3. 11.x core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::newDisplay()

Overrides DisplayPluginBase::newDisplay

File

core/modules/views/src/Plugin/views/display/Feed.php, line 201

Class

Feed
The plugin that handles a feed, such as RSS or atom.

Namespace

Drupal\views\Plugin\views\display

Code

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().
    if (empty($this->options['row']['type']) || $this->options['row']['type'] === 'rss_fields') {
        $row_plugins = Views::fetchPluginNames('row', $this->getType(), [
            $this->view->storage
                ->get('base_table'),
        ]);
        $default_row_plugin = key($row_plugins);
        $options = $this->getOption('row');
        $options['type'] = $default_row_plugin;
        $this->setOption('row', $options);
    }
}

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