You are here

protected function Feed::_setAuthors in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php \Zend\Feed\Writer\Extension\DublinCore\Renderer\Feed::_setAuthors()
  2. 8 vendor/zendframework/zend-feed/src/Writer/Extension/ITunes/Renderer/Feed.php \Zend\Feed\Writer\Extension\ITunes\Renderer\Feed::_setAuthors()
Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php \Zend\Feed\Writer\Extension\DublinCore\Renderer\Feed::_setAuthors()

Set feed authors

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

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

File

vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php, line 63

Class

Feed

Namespace

Zend\Feed\Writer\Extension\DublinCore\Renderer

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('dc:creator');
    if (array_key_exists('name', $data)) {
      $text = $dom
        ->createTextNode($data['name']);
      $author
        ->appendChild($text);
      $root
        ->appendChild($author);
    }
  }
  $this->called = true;
}