diff --git a/core/modules/comment/src/Plugin/views/row/Rss.php b/core/modules/comment/src/Plugin/views/row/Rss.php index 0733cbe..ef43f9b 100644 --- a/core/modules/comment/src/Plugin/views/row/Rss.php +++ b/core/modules/comment/src/Plugin/views/row/Rss.php @@ -59,7 +59,7 @@ public function preRender($result) { */ public function buildOptionsForm_summary_options() { $options = parent::buildOptionsForm_summary_options(); - $options['title'] = $this->t('Title only'); + $options[$this::TITLE_VIEW_MODE] = $this->t('Title only'); return $options; } @@ -102,14 +102,14 @@ public function render($row) { // The comment gets built and modules add to or modify // $comment->rss_elements and $comment->rss_namespaces. - $build = comment_view($comment, 'rss'); + $build = comment_view($comment, $view_mode); unset($build['#theme']); if (!empty($comment->rss_namespaces)) { $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $comment->rss_namespaces); } - if ($view_mode != 'title') { + if ($view_mode != $this::TITLE_VIEW_MODE) { // We render comment contents. $description_build = $build; } diff --git a/core/modules/node/src/Plugin/views/row/Rss.php b/core/modules/node/src/Plugin/views/row/Rss.php index a945919..81d1fd8 100644 --- a/core/modules/node/src/Plugin/views/row/Rss.php +++ b/core/modules/node/src/Plugin/views/row/Rss.php @@ -68,7 +68,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition */ public function buildOptionsForm_summary_options() { $options = parent::buildOptionsForm_summary_options(); - $options['title'] = $this->t('Title only'); + $options['_views.rss.title'] = $this->t('Title only'); return $options; } @@ -126,10 +126,7 @@ public function render($row) { // The node gets built and modules add to or modify $node->rss_elements // and $node->rss_namespaces. - - $build_mode = $display_mode; - - $build = node_view($node, $build_mode); + $build = node_view($node, $display_mode); unset($build['#theme']); if (!empty($node->rss_namespaces)) { @@ -145,7 +142,7 @@ public function render($row) { $this->view->style_plugin->namespaces += $xml_rdf_namespaces; } - if ($display_mode != 'title') { + if ($display_mode != $this::TITLE_VIEW_MODE) { // We render node contents. $description_build = $build; } diff --git a/core/modules/system/config/install/system.rss.yml b/core/modules/system/config/install/system.rss.yml index 994f55c..2a7ea4e 100644 --- a/core/modules/system/config/install/system.rss.yml +++ b/core/modules/system/config/install/system.rss.yml @@ -2,5 +2,4 @@ channel: description: '' items: limit: 10 - view_mode: rss langcode: en diff --git a/core/modules/views/src/Plugin/views/row/RssPluginBase.php b/core/modules/views/src/Plugin/views/row/RssPluginBase.php index a72b313..0c366d9 100644 --- a/core/modules/views/src/Plugin/views/row/RssPluginBase.php +++ b/core/modules/views/src/Plugin/views/row/RssPluginBase.php @@ -17,6 +17,11 @@ abstract class RssPluginBase extends RowPluginBase { /** + * A fake view mode to only display titles. + */ + const TITLE_VIEW_MODE = '_views.rss.title'; + + /** * The entity manager. * * @var \Drupal\Core\Entity\EntityManagerInterface