You are here

protected function Feed::_setFeedLinks in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/Writer/Extension/Atom/Renderer/Feed.php \Zend\Feed\Writer\Extension\Atom\Renderer\Feed::_setFeedLinks()

Set feed link elements

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

1 call to Feed::_setFeedLinks()
Feed::render in vendor/zendframework/zend-feed/src/Writer/Extension/Atom/Renderer/Feed.php
Render feed

File

vendor/zendframework/zend-feed/src/Writer/Extension/Atom/Renderer/Feed.php, line 68

Class

Feed

Namespace

Zend\Feed\Writer\Extension\Atom\Renderer

Code

protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) {
  $flinks = $this
    ->getDataContainer()
    ->getFeedLinks();
  if (!$flinks || empty($flinks)) {
    return;
  }
  foreach ($flinks as $type => $href) {
    if (strtolower($type) == $this
      ->getType()) {

      // issue 2605
      $mime = 'application/' . strtolower($type) . '+xml';
      $flink = $dom
        ->createElement('atom:link');
      $root
        ->appendChild($flink);
      $flink
        ->setAttribute('rel', 'self');
      $flink
        ->setAttribute('type', $mime);
      $flink
        ->setAttribute('href', $href);
    }
  }
  $this->called = true;
}