You are here

public function Rss::render in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Rss.php \Zend\Feed\Writer\Renderer\Entry\Rss::render()
  2. 8 vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php \Zend\Feed\Writer\Renderer\Feed\Rss::render()
  3. 8 core/modules/views/src/Plugin/views/style/Rss.php \Drupal\views\Plugin\views\style\Rss::render()
  4. 8 core/modules/node/src/Plugin/views/row/Rss.php \Drupal\node\Plugin\views\row\Rss::render()
  5. 8 core/modules/comment/src/Plugin/views/row/Rss.php \Drupal\comment\Plugin\views\row\Rss::render()
  6. 8 core/modules/aggregator/src/Plugin/views/row/Rss.php \Drupal\aggregator\Plugin\views\row\Rss::render()
Same name and namespace in other branches
  1. 8.0 core/modules/aggregator/src/Plugin/views/row/Rss.php \Drupal\aggregator\Plugin\views\row\Rss::render()

Render a row object. This usually passes through to a theme template of some form, but not always.

Parameters

object $row: A single row of the query result, so an element of $view->result.

Return value

string The rendered output of a single row, used by the style plugin.

Overrides RowPluginBase::render

File

core/modules/aggregator/src/Plugin/views/row/Rss.php, line 48
Contains \Drupal\aggregator\Plugin\views\row\Rss.

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 = array(
    array(
      'key' => 'pubDate',
      // views_view_row_rss takes care about the escaping.
      'value' => gmdate('r', $entity->timestamp->value),
    ),
    array(
      'key' => 'dc:creator',
      // views_view_row_rss takes care about the escaping.
      'value' => $entity->author->value,
    ),
    array(
      'key' => 'guid',
      // views_view_row_rss takes care about the escaping.
      'value' => $entity->guid->value,
      'attributes' => array(
        'isPermaLink' => 'false',
      ),
    ),
  );
  $build = array(
    '#theme' => $this
      ->themeFunctions(),
    '#view' => $this->view,
    '#options' => $this->options,
    '#row' => $item,
  );
  return $build;
}