You are here

function Rss::render in Views (for Drupal 7) 8.3

Same name in this branch
  1. 8.3 lib/Views/node/Plugin/views/row/Rss.php \Views\node\Plugin\views\row\Rss::render()
  2. 8.3 lib/Views/comment/Plugin/views/row/Rss.php \Views\comment\Plugin\views\row\Rss::render()
  3. 8.3 lib/Views/aggregator/Plugin/views/row/Rss.php \Views\aggregator\Plugin\views\row\Rss::render()
  4. 8.3 lib/Drupal/views/Plugin/views/style/Rss.php \Drupal\views\Plugin\views\style\Rss::render()

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

Parameters

stdClass $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

lib/Views/aggregator/Plugin/views/row/Rss.php, line 53
Definition of Views\aggregator\Plugin\views\row\Rss.

Class

Rss
Plugin which loads an aggregator item and formats it as an RSS item.

Namespace

Views\aggregator\Plugin\views\row

Code

function render($row) {
  $iid = $row->{$this->field_alias};
  $query = db_select('aggregator_item', 'ai');
  $query
    ->leftJoin('aggregator_feed', 'af', 'ai.fid = af.fid');
  $query
    ->fields('ai');
  $query
    ->addExpression('af.title', 'feed_title');
  $query
    ->addExpression('ai.link', 'feed_LINK');
  $query
    ->condition('iid', $iid);
  $result = $query
    ->execute();
  $item->elements = array(
    array(
      'key' => 'pubDate',
      'value' => gmdate('r', $item->timestamp),
    ),
    array(
      'key' => 'dc:creator',
      'value' => $item->author,
    ),
    array(
      'key' => 'guid',
      'value' => $item->guid,
      'attributes' => array(
        'isPermaLink' => 'false',
      ),
    ),
  );
  foreach ($item->elements as $element) {
    if (isset($element['namespace'])) {
      $this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $element['namespace']);
    }
  }
  return theme($this
    ->themeFunctions(), array(
    'view' => $this->view,
    'options' => $this->options,
    'row' => $item,
  ));
}