/** * Delete a content page from the database. * * @param bool $deleteChildren Set to true if the method should also delete * children pages. * @access public * @return void */ public function deleteContent($deleteChildren = true) { if ($this->id == 0) { return false; } // If the page children must also be removed, let the page tree class // handle content delete action. if ($deleteChildren == true) { $tree = new PageTree(); return $tree->removePage($this->id); } $innomaticContainer = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); if ($this->domainDa->execute("DELETE FROM innomedia_pages WHERE id={$this->id}")) { $this->domainDa->execute("DELETE FROM innomedia_blocks WHERE pageid={$this->id}"); // @TODO: convert the following code in the code with the use of hook // Start - code for delete element of menu ordering $app_deps = new \Innomatic\Application\ApplicationDependencies($innomaticContainer->getDataAccess()); if ($app_deps->isInstalled('innomedia-menu-editor') && $app_deps->isEnabled('innomedia-menu-editor', $innomaticContainer->getCurrentTenant()->getDomainId())) { //delete element from secondary menu ordering $editorMenu = new \Innomedia\Menu\Editor\Menu(DesktopFrontController::instance('\\Innomatic\\Desktop\\Controller\\DesktopFrontController')->session, null, 'menu/includemenu'); $editorMenu->removeElementFromMenuByPageID($this->id); } // End - code for delete element of menu ordering $this->id = 0; return true; } else { return false; } }