Example #1
0
 /**
  * On delete node.
  *
  * @param NodeInterface $node
  */
 public function onDeleteNode(NodeInterface $node)
 {
     $textNode = $this->textNodeManager->findTextNodeByNode($node);
     if (null !== $textNode) {
         $this->textNodeManager->remove($textNode);
         $this->textManager->remove($textNode->getText());
     }
 }
 /**
  * Get text node.
  *
  * @param NodeInterface $node
  *
  * @return TextNodeInterface
  */
 private function getTextNode(NodeInterface $node)
 {
     $textNode = $this->textNodeManager->findTextNodeByNode($node);
     if (null === $textNode) {
         $textNode = $this->textNodeManager->create();
         $text = $this->textManager->create();
         $textNode->setText($text);
         $textNode->setNode($node);
         $this->textManager->add($text);
         $this->textNodeManager->add($textNode);
     }
     return $textNode;
 }
 /**
  * On edit text node success.
  *
  * @param string $locale
  * @param NodeInterface $node
  *
  * @return string
  */
 public function onSuccess($locale, NodeInterface $node)
 {
     $this->eventDispatcher->dispatch(TadckaTreeEvents::NODE_EDIT_SUCCESS, new TreeNodeEvent($locale, $node));
     $this->textNodeManager->save();
     return $this->translator->trans('success.text_node_save', array(), 'SilvestraTextNodeBundle');
 }