You are here

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

Set feed authors

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

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

File

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

Class

Rss

Namespace

Zend\Feed\Writer\Renderer\Feed

Code

protected function _setAuthors(DOMDocument $dom, DOMElement $root) {
  $authors = $this
    ->getDataContainer()
    ->getAuthors();
  if (!$authors || empty($authors)) {
    return;
  }
  foreach ($authors as $data) {
    $author = $this->dom
      ->createElement('author');
    $name = $data['name'];
    if (array_key_exists('email', $data)) {
      $name = $data['email'] . ' (' . $data['name'] . ')';
    }
    $text = $dom
      ->createTextNode($name);
    $author
      ->appendChild($text);
    $root
      ->appendChild($author);
  }
}