public function onBeforeDeletePageCommit(BeforeDeletePageCommitEvent $event)
    {
        if ($event->isAborted()) {
            return;
        }

        $pageManager = $event->getContentManager();
        $pageRepository = $pageManager->getPageRepository();

        try {
            $languages = $this->languageRepository->activeLanguages();
            if (count($languages) > 0) {
                $idPage = $pageManager->get()->getId();
                $pageRepository->startTransaction();

                foreach ($languages as $alLanguage) {
                    $this->blockRepository->deleteBlocks($alLanguage->getId(), $idPage);
                }

                $pageRepository->commit();

                return true;
            }
        } catch (\Exception $e) {
            $event->abort();
            if (isset($pageRepository) && $pageRepository !== null) {
                $pageRepository->rollBack();
            }

            throw $e;
        }
    }
public function onBeforeDeletePageCommit(BeforeDeletePageCommitEvent $event)
    {
        if ($event->isAborted()) {
            return;
        }

        $pageManager = $event->getContentManager();
        $pageRepository = $pageManager->getPageRepository();

        try {
            $languages = $this->languageRepository->activeLanguages();
            if (count($languages) > 0) {
                $idPage = $pageManager->get()->getId();
                $pageRepository->startTransaction();

                foreach ($languages as $alLanguage) {
                    $this->blockRepository->deleteBlocks($alLanguage->getId(), $idPage);
                }

                $pageRepository->commit();

                return true;
            }
        } catch (\Exception $e) {
            $event->abort();
            if (isset($pageRepository) && $pageRepository !== null) {
                $pageRepository->rollBack();
            }

            throw $e;
        }
    }
public function onBeforeDeletePageCommit ( BeforeDeletePageCommitEvent $ event ) { if ( $ event -> isAborted ( ) ) { return ; } $ pageManager = $ event -> getContentManager ( ) ; $ pageRepository = $ pageManager -> getPageRepository ( ) ; try { $ languages = $ this -> languageRepository -> activeLanguages ( ) ; if ( count ( $ languages ) > 0 ) { $ idPage = $ pageManager -> get ( ) -> getId ( ) ; $ pageRepository -> startTransaction ( ) ; foreach ( $ languages as $ alLanguage ) { $ this -> blockRepository -> deleteBlocks ( $ alLanguage -> getId ( ) , $ idPage ) ; } $ pageRepository -> commit ( ) ; return true ; } } catch ( \ Exception $ e ) { $ event -> abort ( ) ; if ( isset ( $ pageRepository ) && $ pageRepository !== null ) { $ pageRepository -> rollBack ( ) ; } throw $ e ; } }
Deletes the page's contents, for all the languages of the site

@param  BeforeDeletePageCommitEvent $event
@return boolean
@throws \Exception

@api
Deletes the page s contents for all the languages of the site