/** * Removes a node * @param \ride\library\cms\node\Node $node Node to remove * @param boolean $recursive Flag to see if child nodes should be deleted * @param string $description Description of the remove action * @param boolean $autoPublish Set to false to skip auto publishing * @return */ public function removeNode(Node $node, $recursive = true, $description = null, $autoPublish = true) { if ($node->getRevision() === $this->defaultRevision && $node->getLevel() !== 0) { $node->setRevision($this->draftRevision); } if ($this->eventManager) { if (!$description) { $description = 'Removed node ' . $node->getName(); } $eventArguments = array('action' => 'remove', 'nodes' => array($node), 'description' => $description); $this->eventManager->triggerEvent(self::EVENT_PRE_ACTION, $eventArguments); } $this->io->removeNode($node, $recursive); if ($this->eventManager) { $this->eventManager->triggerEvent(self::EVENT_POST_ACTION, $eventArguments); } $rootNode = $node->getRootNode(); if ($autoPublish && $node->getId() != $rootNode->getId() && $rootNode->isAutoPublish()) { $this->publishNode($node); } }