framework/RedKiteCms/EventSystem/Listener/PageCollection/PageSavedListener.php
public function onPageSaved(PageSavedEvent $event)
    {
        $blocks = $event->getApprovedBlocks();
        foreach ($blocks as $blockk) {
            foreach ($blockk as $block) {
                $this->pageProductionRenderer->renderBlock(json_encode($block));
            }
        }
        $mediaFiles = array_unique($this->pageProductionRenderer->getMediaFiles());

        $webDir = $this->configurationHandler->webDir();
        $fs = new Filesystem();
        foreach ($mediaFiles as $mediaFile) {
            $targetMediaFile = str_replace('/backend/', '/production/', $mediaFile);
            $fs->copy($webDir . $mediaFile, $webDir . $targetMediaFile);
        }
    }
public function onPageSaved(PageSavedEvent $event)
    {
        $blocks = $event->getApprovedBlocks();
        foreach ($blocks as $blockk) {
            foreach ($blockk as $block) {
                $this->pageProductionRenderer->renderBlock(json_encode($block));
            }
        }
        $mediaFiles = array_unique($this->pageProductionRenderer->getMediaFiles());

        $webDir = $this->configurationHandler->webDir();
        $fs = new Filesystem();
        foreach ($mediaFiles as $mediaFile) {
            $targetMediaFile = str_replace('/backend/', '/production/', $mediaFile);
            $fs->copy($webDir . $mediaFile, $webDir . $targetMediaFile);
        }
    }
public function onPageSaved ( PageSavedEvent $ event ) { $ blocks = $ event -> getApprovedBlocks ( ) ; foreach ( $ blocks as $ blockk ) { foreach ( $ blockk as $ block ) { $ this -> pageProductionRenderer -> renderBlock ( json_encode ( $ block ) ) ; } } $ mediaFiles = array_unique ( $ this -> pageProductionRenderer -> getMediaFiles ( ) ) ; $ webDir = $ this -> configurationHandler -> webDir ( ) ; $ fs = new Filesystem ( ) ; foreach ( $ mediaFiles as $ mediaFile ) { $ targetMediaFile = str_replace ( '/backend/' , '/production/' , $ mediaFile ) ; $ fs -> copy ( $ webDir . $ mediaFile , $ webDir . $ targetMediaFile ) ; } }
Copies the assets from the backend to production

@param \RedKiteCms\EventSystem\Event\Page\PageSavedEvent $event
Copies the assets from the backend to production