setDocument() public method

Set the document
public setDocument ( TYPO3\TYPO3CR\Domain\Model\NodeInterface $document ) : void
$document TYPO3\TYPO3CR\Domain\Model\NodeInterface
return void
示例#1
0
 /**
  * Inform the client to reload the currently-displayed document, because the rendering has changed.
  *
  * This method will be triggered if [nodeType].properties.[propertyName].ui.reloadIfChanged is TRUE.
  *
  * @return void
  */
 protected function reloadDocument()
 {
     $nodeService = new NodeService();
     $reloadDocument = new ReloadDocument();
     $reloadDocument->setDocument($nodeService->getClosestDocument($this->getSubject()));
     $this->feedbackCollection->add($reloadDocument);
 }
示例#2
0
 /**
  * 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;
 }
示例#3
0
 /**
  * Discard nodes
  *
  * @param array $nodeContextPaths
  * @return void
  */
 public function discardAction(array $nodeContextPaths)
 {
     try {
         foreach ($nodeContextPaths as $contextPath) {
             $node = $this->nodeService->getNodeFromContextPath($contextPath);
             $this->publishingService->discardNode($node);
             $reloadDocument = new ReloadDocument();
             $reloadDocument->setDocument($this->nodeService->getClosestDocument($node));
             $this->feedbackCollection->add($reloadDocument);
         }
         $success = new Success();
         $success->setMessage(sprintf('Discarded %d node(s).', count($nodeContextPaths)));
         $this->updateWorkspaceInfo($nodeContextPaths[0]);
         $this->feedbackCollection->add($success);
         $this->persistenceManager->persistAll();
     } catch (\Exception $e) {
         $error = new Error();
         $error->setMessage($e->getMessage());
         $this->feedbackCollection->add($error);
     }
     $this->view->assign('value', $this->feedbackCollection);
 }