105 if (isset($this->availableNodes[$name])) {
106 $nodeInfo = $this->availableNodes[$name];
107 $docInfo = $this->document->getNamespacesAndEntities();
109 if (isset($nodeInfo->xmlTemplateData)) {
110 $xml = $nodeInfo->xmlTemplateData;
112 $xml =
"<$name {$docInfo->namespaces}";
113 if (!empty($nodeInfo->newName)) {
114 $xml .=
" name=\"" . htmlspecialchars($nodeInfo->newName) .
"\"";
116 if (isset($nodeInfo->attributes)) {
117 foreach ($nodeInfo->attributes as $attr => $value) {
118 $xml .=
" $attr=\"" . htmlspecialchars($value) .
"\"";
123 $doc = new \DOMDocument();
124 $doc->loadXML(
"<root xmlns:pg=\"http://cms.depagecms.net/ns/page\" xmlns:sec=\"http://cms.depagecms.net/ns/section\" xmlns:edit=\"http://cms.depagecms.net/ns/edit\">$xml</root>");
126 $result = $doc->documentElement->childNodes;
144 if (isset($this->validParents[
'*'])) {
145 $result = in_array(
'*', $this->validParents[
'*']) || in_array($targetNodeName, $this->validParents[
'*']);
146 } elseif (isset($this->validParents[$nodeName])) {
147 $result = in_array(
'*', $this->validParents[$nodeName]) || in_array($targetNodeName, $this->validParents[$nodeName]);
165 $this->document->getNodeNameById($targetId)
193 $this->document->getNodeNameById($nodeId),
194 $this->document->getNodeNameById($targetId)
231 public function onAddNode(\DomNode $node, $targetId, $targetIndex, $extras)
Default doctype handler of a document.
isAllowedDelete($nodeId)
checks whether a node may be deleted
__construct($xmlDb, $document)
getPreserveWhitespace()
gets the names of the nodes whose whitespace is not stripped while the document is saved
getNewNodeFor($name)
builds the node that is created by Document\addNodeByName()
onCopyNode($nodeId, $copyId)
called when a node is copied
getValidParents()
gets the names of the nodes a node may be placed in, indexed by the name of the node
isAllowedCopy($nodeId, $targetId)
checks whether a node may be copied to a target node
testDocumentForHistory($xml)
called when a version of the document is written to the history; the document may be changed here
testDocument($xml)
called when a document is read; the document may be changed here
getAvailableNodes()
gets the nodes that may be created by name, indexed by their name
onHistorySave()
called when a version of the document is written to the history
isAllowedMove($nodeId, $targetId)
checks whether a node may be moved to a target node
getPermissions()
gets the rules of the document
onMoveNode($nodeId, $oldParentId)
called when a node is moved
onAddNode(\DomNode $node, $targetId, $targetIndex, $extras)
called when a node is added to the document
onSetAttribute($nodeId, $attrName, $oldVal, $newVal)
called when an attribute of a node is changed
onDocumentChange()
called after the document has been changed and committed
isAllowedIn($nodeName, $targetNodeName)
checks whether a node may be placed in another node
isAllowedAdd($node, $targetId)
checks whether a node may be added to a target node
onDeleteNode($nodeId, $parentId)
called when a node is deleted
Interface of the doctype handler of a document.