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 vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php \Zend\Feed\Writer\Renderer\Feed\Rss::render()

Render RSS feed

Return value

self

File

vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php, line 39

Class

Rss

Namespace

Zend\Feed\Writer\Renderer\Feed

Code

public function render() {
  $this->dom = new DOMDocument('1.0', $this->container
    ->getEncoding());
  $this->dom->formatOutput = true;
  $this->dom->substituteEntities = false;
  $rss = $this->dom
    ->createElement('rss');
  $this
    ->setRootElement($rss);
  $rss
    ->setAttribute('version', '2.0');
  $channel = $this->dom
    ->createElement('channel');
  $rss
    ->appendChild($channel);
  $this->dom
    ->appendChild($rss);
  $this
    ->_setLanguage($this->dom, $channel);
  $this
    ->_setBaseUrl($this->dom, $channel);
  $this
    ->_setTitle($this->dom, $channel);
  $this
    ->_setDescription($this->dom, $channel);
  $this
    ->_setImage($this->dom, $channel);
  $this
    ->_setDateCreated($this->dom, $channel);
  $this
    ->_setDateModified($this->dom, $channel);
  $this
    ->_setLastBuildDate($this->dom, $channel);
  $this
    ->_setGenerator($this->dom, $channel);
  $this
    ->_setLink($this->dom, $channel);
  $this
    ->_setAuthors($this->dom, $channel);
  $this
    ->_setCopyright($this->dom, $channel);
  $this
    ->_setCategories($this->dom, $channel);
  foreach ($this->extensions as $ext) {
    $ext
      ->setType($this
      ->getType());
    $ext
      ->setRootElement($this
      ->getRootElement());
    $ext
      ->setDOMDocument($this
      ->getDOMDocument(), $channel);
    $ext
      ->render();
  }
  foreach ($this->container as $entry) {
    if ($this
      ->getDataContainer()
      ->getEncoding()) {
      $entry
        ->setEncoding($this
        ->getDataContainer()
        ->getEncoding());
    }
    if ($entry instanceof Writer\Entry) {
      $renderer = new Renderer\Entry\Rss($entry);
    }
    else {
      continue;
    }
    if ($this->ignoreExceptions === true) {
      $renderer
        ->ignoreExceptions();
    }
    $renderer
      ->setType($this
      ->getType());
    $renderer
      ->setRootElement($this->dom->documentElement);
    $renderer
      ->render();
    $element = $renderer
      ->getElement();
    $deep = version_compare(PHP_VERSION, '7', 'ge') ? 1 : true;
    $imported = $this->dom
      ->importNode($element, $deep);
    $channel
      ->appendChild($imported);
  }
  return $this;
}