You are here

public function Feed::newDisplay in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/display/Feed.php \Drupal\views\Plugin\views\display\Feed::newDisplay()

Reacts on adding a display.

Overrides DisplayPluginBase::newDisplay

See also

\Drupal\views\Entity\View::newDisplay()

File

core/modules/views/src/Plugin/views/display/Feed.php, line 161
Contains \Drupal\views\Plugin\views\display\Feed.

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(), array(
      $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);
  }
}