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

8.0.x
Nathaniel Catchpole 2015-06-12 16:10:37 +01:00
parent 53c197a6e1
commit 872b4963ec
2 changed files with 25 additions and 17 deletions

View File

@ -72,3 +72,8 @@ display:
position: null
display_options:
path: test-comment-rss
defaults:
row: false
row:
type: comment_rss
options: {}

View File

@ -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 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
$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().
*/