]> BookStack Code Mirror - bookstack/blobdiff - app/Util/HtmlDocument.php
Includes: Developed to get new system working with inline includes
[bookstack] / app / Util / HtmlDocument.php
index b8c53d43916294dccf63ed3821222f2888edf22d..ad5dacd82f3c23744bbf9992396fd859c822473f 100644 (file)
@@ -149,4 +149,19 @@ class HtmlDocument
     {
         return $this->document->saveHTML($node);
     }
+
+    /**
+     * Adopt the given nodes into this document.
+     * @param DOMNode[] $nodes
+     * @return DOMNode[]
+     */
+    public function adoptNodes(array $nodes): array
+    {
+        $adopted = [];
+        foreach ($nodes as $node) {
+            $adopted[] = $this->document->importNode($node, true);
+        }
+
+        return $adopted;
+    }
 }