Commit 872b4963 authored by catch's avatar catch

Issue #2495073 by dawehner, catch: Views feed display plugin has to get all views data on init

parent 53c197a6
......@@ -72,3 +72,8 @@ display:
position: null
display_options:
path: test-comment-rss
defaults:
row: false
row:
type: comment_rss
options: {}
......@@ -46,22 +46,6 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
*/
protected $usesPager = FALSE;
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::initDisplay().
*/
public function initDisplay(ViewExecutable $view, array &$display, array &$options = NULL) {
parent::initDisplay($view, $display, $options);
// 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($view->storage->get('base_table')));
$default_row_plugin = key($row_plugins);
if (empty($this->options['row']['type'])) {
$this->options['row']['type'] = $default_row_plugin;
}
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::getType().
*/
......@@ -166,13 +150,32 @@ 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;
return $options;
}
/**
* {@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().
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);
}
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment