You are here

protected function Atom::_setTitle in Zircon Profile 8.0

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

Set entry title

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

Throws

Writer\Exception\InvalidArgumentException

1 call to Atom::_setTitle()
Atom::render in vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php
Render atom entry

File

vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php, line 74

Class

Atom

Namespace

Zend\Feed\Writer\Renderer\Entry

Code

protected function _setTitle(DOMDocument $dom, DOMElement $root) {
  if (!$this
    ->getDataContainer()
    ->getTitle()) {
    $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:title element but a title has not been set';
    $exception = new Writer\Exception\InvalidArgumentException($message);
    if (!$this->ignoreExceptions) {
      throw $exception;
    }
    else {
      $this->exceptions[] = $exception;
      return;
    }
  }
  $title = $dom
    ->createElement('title');
  $root
    ->appendChild($title);
  $title
    ->setAttribute('type', 'html');
  $cdata = $dom
    ->createCDATASection($this
    ->getDataContainer()
    ->getTitle());
  $title
    ->appendChild($cdata);
}