You are here

protected function Rss::_setDescription in Zircon Profile 8.0

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

Set entry description

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

Throws

Writer\Exception\InvalidArgumentException

1 call to Rss::_setDescription()
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 103

Class

Rss

Namespace

Zend\Feed\Writer\Renderer\Entry

Code

protected function _setDescription(DOMDocument $dom, DOMElement $root) {
  if (!$this
    ->getDataContainer()
    ->getDescription() && !$this
    ->getDataContainer()
    ->getTitle()) {
    $message = 'RSS 2.0 entry elements SHOULD contain exactly one' . ' description element but a description has not been set. In' . ' addition, there is no title element as required in the absence' . ' of a description.';
    $exception = new Writer\Exception\InvalidArgumentException($message);
    if (!$this->ignoreExceptions) {
      throw $exception;
    }
    else {
      $this->exceptions[] = $exception;
      return;
    }
  }
  if (!$this
    ->getDataContainer()
    ->getDescription()) {
    return;
  }
  $subtitle = $dom
    ->createElement('description');
  $root
    ->appendChild($subtitle);
  $text = $dom
    ->createCDATASection($this
    ->getDataContainer()
    ->getDescription());
  $subtitle
    ->appendChild($text);
}