You are here

public function views_plugin_row_aggregator_rss::render in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 modules/aggregator/views_plugin_row_aggregator_rss.inc \views_plugin_row_aggregator_rss::render()
  2. 6.2 modules/aggregator/views_plugin_row_aggregator_rss.inc \views_plugin_row_aggregator_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 views_plugin_row::render

File

modules/aggregator/views_plugin_row_aggregator_rss.inc, line 54
Definition of views_plugin_row_aggregator_rss.

Class

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

Code

public function render($row) {
  $iid = $row->{$this->field_alias};
  $sql = "SELECT ai.iid, ai.fid, ai.title, ai.link, ai.author, ai.description, ";
  $sql .= "ai.timestamp, ai.guid, af.title AS feed_title, ai.link AS feed_LINK ";
  $sql .= "FROM {aggregator_item} ai LEFT JOIN {aggregator_feed} af ON ai.fid = af.fid ";
  $sql .= "WHERE ai.iid = :iid";
  $item = db_query($sql, array(
    ':iid' => $iid,
  ))
    ->fetchObject();
  $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
    ->theme_functions(), array(
    'view' => $this->view,
    'options' => $this->options,
    'row' => $item,
  ));
}