function Rss::render

Same name in this branch
  1. 8.9.x core/modules/node/src/Plugin/views/row/Rss.php \Drupal\node\Plugin\views\row\Rss::render()
  2. 8.9.x core/modules/views/src/Plugin/views/style/Rss.php \Drupal\views\Plugin\views\style\Rss::render()
  3. 8.9.x core/modules/comment/src/Plugin/views/row/Rss.php \Drupal\comment\Plugin\views\row\Rss::render()
Same name and namespace in other branches
  1. 9 core/modules/node/src/Plugin/views/row/Rss.php \Drupal\node\Plugin\views\row\Rss::render()
  2. 9 core/modules/views/src/Plugin/views/style/Rss.php \Drupal\views\Plugin\views\style\Rss::render()
  3. 9 core/modules/aggregator/src/Plugin/views/row/Rss.php \Drupal\aggregator\Plugin\views\row\Rss::render()
  4. 9 core/modules/comment/src/Plugin/views/row/Rss.php \Drupal\comment\Plugin\views\row\Rss::render()
  5. 10 core/modules/node/src/Plugin/views/row/Rss.php \Drupal\node\Plugin\views\row\Rss::render()
  6. 10 core/modules/views/src/Plugin/views/style/Rss.php \Drupal\views\Plugin\views\style\Rss::render()
  7. 10 core/modules/comment/src/Plugin/views/row/Rss.php \Drupal\comment\Plugin\views\row\Rss::render()
  8. 11.x core/modules/node/src/Plugin/views/row/Rss.php \Drupal\node\Plugin\views\row\Rss::render()
  9. 11.x core/modules/views/src/Plugin/views/style/Rss.php \Drupal\views\Plugin\views\style\Rss::render()
  10. 11.x core/modules/comment/src/Plugin/views/row/Rss.php \Drupal\comment\Plugin\views\row\Rss::render()

Overrides RowPluginBase::render

File

core/modules/aggregator/src/Plugin/views/row/Rss.php, line 43

Class

Rss
Defines a row plugin which loads an aggregator item and renders as RSS.

Namespace

Drupal\aggregator\Plugin\views\row

Code

public function render($row) {
    $entity = $row->_entity;
    $item = new \stdClass();
    foreach ($entity as $name => $field) {
        $item->{$name} = $field->value;
    }
    $item->elements = [
        [
            'key' => 'pubDate',
            // views_view_row_rss takes care about the escaping.
'value' => gmdate('r', $entity->timestamp->value),
        ],
        [
            'key' => 'dc:creator',
            // views_view_row_rss takes care about the escaping.
'value' => $entity->author->value,
        ],
        [
            'key' => 'guid',
            // views_view_row_rss takes care about the escaping.
'value' => $entity->guid->value,
            'attributes' => [
                'isPermaLink' => 'false',
            ],
        ],
    ];
    $build = [
        '#theme' => $this->themeFunctions(),
        '#view' => $this->view,
        '#options' => $this->options,
        '#row' => $item,
    ];
    return $build;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.