You are here

protected function Rss::_setId in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Rss.php \Zend\Feed\Writer\Renderer\Entry\Rss::_setId()

Set entry identifier

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

1 call to Rss::_setId()
Rss::render in vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Rss.php
Render RSS entry

File

vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Rss.php, line 267

Class

Rss

Namespace

Zend\Feed\Writer\Renderer\Entry

Code

protected function _setId(DOMDocument $dom, DOMElement $root) {
  if (!$this
    ->getDataContainer()
    ->getId() && !$this
    ->getDataContainer()
    ->getLink()) {
    return;
  }
  $id = $dom
    ->createElement('guid');
  $root
    ->appendChild($id);
  if (!$this
    ->getDataContainer()
    ->getId()) {
    $this
      ->getDataContainer()
      ->setId($this
      ->getDataContainer()
      ->getLink());
  }
  $text = $dom
    ->createTextNode($this
    ->getDataContainer()
    ->getId());
  $id
    ->appendChild($text);
  if (!Uri::factory($this
    ->getDataContainer()
    ->getId())
    ->isValid()) {
    $id
      ->setAttribute('isPermaLink', 'false');
  }
}