/** * Creates a new node beneath $parent * * @param NodeInterface $parent * @return NodeInterface */ protected function createNode(NodeInterface $parent) { $nodeType = $this->getNodeType(); $name = $this->getName() ?: $this->nodeService->generateUniqueNodeName($parent->getPath()); $node = $parent->createNode($name, $nodeType); $this->applyNodeCreationHandlers($node); $this->persistenceManager->persistAll(); if ($nodeType->isOfType('TYPO3.Neos:Content') && ($this->getParentDomAddress() || $this->getSiblingDomAddress())) { if ($parent->getNodeType()->isOfType('TYPO3.Neos:ContentCollection')) { $renderContentOutOfBand = new RenderContentOutOfBand(); $renderContentOutOfBand->setNode($node); $renderContentOutOfBand->setParentDomAddress($this->getParentDomAddress()); $renderContentOutOfBand->setSiblingDomAddress($this->getSiblingDomAddress()); $renderContentOutOfBand->setMode($this->getMode()); $this->feedbackCollection->add($renderContentOutOfBand); } else { $flowQuery = new FlowQuery(array($node)); $closestDocument = $flowQuery->closest('[instanceof TYPO3.Neos:Document]')->get(0); $reloadDocument = new ReloadDocument(); $reloadDocument->setDocument($closestDocument); $this->feedbackCollection->add($reloadDocument); } } $updateNodeInfo = new UpdateNodeInfo(); $updateNodeInfo->setNode($node); $this->feedbackCollection->add($updateNodeInfo); return $node; }