Unverified Commit 90d56c46 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2601030 by alexpott, catch, longwave, bbrala: Views RSS view mode...

Issue #2601030 by alexpott, catch, longwave, bbrala: Views RSS view mode settings are completely broken
parent 4ba82cdc
Loading
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -66,8 +66,7 @@ public function preRender($result) {
   */
  public function buildOptionsForm_summary_options() {
    $options = parent::buildOptionsForm_summary_options();
    $options['title'] = $this->t('Title only');
    $options['default'] = $this->t('Use site default RSS settings');
    $options[$this::TITLE_VIEW_MODE] = $this->t('Title only');
    return $options;
  }

@@ -83,9 +82,6 @@ public function render($row) {
    }

    $view_mode = $this->options['view_mode'];
    if ($view_mode == 'default') {
      $view_mode = \Drupal::config('system.rss')->get('items.view_mode');
    }

    // Load the specified comment and its associated node:
    /** @var \Drupal\comment\CommentInterface $comment */
@@ -113,7 +109,7 @@ public function render($row) {

    // The comment gets built and modules add to or modify
    // $comment->rss_elements and $comment->rss_namespaces.
    $build = $this->entityTypeManager->getViewBuilder('comment')->view($comment, 'rss');
    $build = $this->entityTypeManager->getViewBuilder('comment')->view($comment, $view_mode);
    unset($build['#theme']);

    if (!empty($comment->rss_namespaces)) {
@@ -121,7 +117,7 @@ public function render($row) {
    }

    $item = new \stdClass();
    if ($view_mode != 'title') {
    if ($view_mode != $this::TITLE_VIEW_MODE) {
      // We render comment contents.
      $item->description = $build;
    }
+0 −5
Original line number Diff line number Diff line
@@ -471,11 +471,6 @@ public function testGetConfigData(): void {
        'enabled' => FALSE,
        'message' => '@site is currently under maintenance.',
      ],
      'system.rss' => [
        'items' => [
          'view_mode' => 'rss',
        ],
      ],
    ];

    $this->configNamesMapper->setConfigNames(array_keys($configs));
+3 −9
Original line number Diff line number Diff line
@@ -51,8 +51,7 @@ class Rss extends RssPluginBase {
   */
  public function buildOptionsForm_summary_options() {
    $options = parent::buildOptionsForm_summary_options();
    $options['title'] = $this->t('Title only');
    $options['default'] = $this->t('Use site default RSS settings');
    $options[$this::TITLE_VIEW_MODE] = $this->t('Title only');
    return $options;
  }

@@ -89,9 +88,6 @@ public function render($row) {
    }

    $display_mode = $this->options['view_mode'];
    if ($display_mode == 'default') {
      $display_mode = \Drupal::config('system.rss')->get('items.view_mode');
    }

    // Load the specified node:
    /** @var \Drupal\node\NodeInterface $node */
@@ -120,11 +116,9 @@ 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 = \Drupal::entityTypeManager()
      ->getViewBuilder('node')
      ->view($node, $build_mode);
      ->view($node, $display_mode);
    // Add rss key to cache to differentiate this from other caches.
    $build['#cache']['keys'][] = 'view_rss';

@@ -135,7 +129,7 @@ public function render($row) {
    }

    $item = new \stdClass();
    if ($display_mode != 'title') {
    if ($display_mode != $this::TITLE_VIEW_MODE) {
      // We render node contents.
      $item->description = $build;
    }
+0 −2
Original line number Diff line number Diff line
items:
  view_mode: rss
+0 −12
Original line number Diff line number Diff line
@@ -236,18 +236,6 @@ system.performance:
          type: boolean
          label: 'Compress JavaScript files.'

system.rss:
  type: config_object
  label: 'Feed settings'
  mapping:
    items:
      type: mapping
      label: 'Feed items'
      mapping:
        view_mode:
          type: string
          label: 'Feed content'

system.theme:
  type: config_object
  label: 'Theme settings'
Loading