private function appendManifestElement(\DOMDocument $document, Manifest $manifest) { $node = $document->createElement('manifest'); foreach ($manifest->all() as $item) { // $child = $document->createElementNS(NamespaceRegistry::NAMESPACE_DC, $item->name, $item->value); $child = $document->createElement('item'); $child->setAttribute('id', $item->id); $child->setAttribute('href', $item->href); if ($item->type) { $child->setAttribute('media-type', $item->type); } if ($item->fallback) { $child->setAttribute('fallback', $item->fallback); } $node->appendChild($child); } return $node; }
private function processSpineElement(SimpleXMLElement $xml, Spine $spine, Manifest $manifest, Navigation $navigation) { $position = 1; foreach ($xml->itemref as $child) { $id = (string) $child['idref']; $manifestItem = $manifest->get($id); if (!($linear = $child['linear'])) { $linear = 'yes'; } $item = new SpineItem(); $item->id = $id; $item->type = $manifestItem->type; $item->href = $manifestItem->href; $item->order = $position; $item->linear = $linear; $this->addContentGetter($item); $spine->add($item); $position++; } $ncxId = $xml['toc'] ? (string) $xml['toc'] : 'ncx'; if ($manifest->has($ncxId)) { $navigation->src = $manifest->get($ncxId); } }