You are here

protected function Atom::_setEnclosure in Zircon Profile 8

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

Set entry enclosure

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

1 call to Atom::_setEnclosure()
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 211

Class

Atom

Namespace

Zend\Feed\Writer\Renderer\Entry

Code

protected function _setEnclosure(DOMDocument $dom, DOMElement $root) {
  $data = $this->container
    ->getEnclosure();
  if (!$data || empty($data)) {
    return;
  }
  $enclosure = $this->dom
    ->createElement('link');
  $enclosure
    ->setAttribute('rel', 'enclosure');
  if (isset($data['type'])) {
    $enclosure
      ->setAttribute('type', $data['type']);
  }
  if (isset($data['length'])) {
    $enclosure
      ->setAttribute('length', $data['length']);
  }
  $enclosure
    ->setAttribute('href', $data['uri']);
  $root
    ->appendChild($enclosure);
}