src/Kunstmaan/GeneratorBundle/Generator/KunstmaanGenerator.php
protected function installDefaultPageTemplates($bundle)
    {
        // Configuration templates
        if ($this->isSymfony4()) {
            $dirPath = $this->container->getParameter('kernel.project_dir') . '/config/kunstmaancms/pagetemplates/';
        } else {
            $dirPath = sprintf('%s/Resources/config/pagetemplates/', $bundle->getPath());
        }

        $skeletonDir = sprintf('%s/Resources/config/pagetemplates/', GeneratorUtils::getFullSkeletonPath('/common'));

        // Only copy templates over when the folder does not exist yet...
        if (!$this->filesystem->exists($dirPath)) {
            $files = array(
                'default-one-column.yml',
                'default-two-column-left.yml',
                'default-two-column-right.yml',
                'default-three-column.yml',
            );
            foreach ($files as $file) {
                $this->filesystem->copy($skeletonDir . $file, $dirPath . $file, false);
                GeneratorUtils::replace('~~~BUNDLE~~~', $bundle->getName(), $dirPath . $file);
            }
        }

        // Twig templates
        $dirPath = $this->getTemplateDir($bundle) . '/Pages/Common/';

        $skeletonDir = sprintf('%s/Resources/views/Pages/Common/', GeneratorUtils::getFullSkeletonPath('/common'));

        if (!$this->filesystem->exists($dirPath)) {
            $files = array(
                'one-column-pagetemplate.html.twig',
                'two-column-left-pagetemplate.html.twig',
                'two-column-right-pagetemplate.html.twig',
                'three-column-pagetemplate.html.twig',
            );
            foreach ($files as $file) {
                $this->filesystem->copy($skeletonDir . $file, $dirPath . $file, false);
            }
            $this->filesystem->copy($skeletonDir . 'view.html.twig', $dirPath . 'view.html.twig', false);
        }

        $contents = file_get_contents($dirPath . 'view.html.twig');

        $twigFile = $this->isSymfony4() ?
            $twigFile = "{% extends 'Layout/layout.html.twig' %}\n" :
            $twigFile = "{% extends '".$bundle->getName().":Layout:layout.html.twig' %}\n"
        ;

        if (strpos($contents, '{% extends ') === false) {
            GeneratorUtils::prepend(
                $twigFile,
                $dirPath . 'view.html.twig'
            );
        }
    }
protected function installDefaultPageTemplates($bundle)
    {
        // Configuration templates
        if ($this->isSymfony4()) {
            $dirPath = $this->container->getParameter('kernel.project_dir') . '/config/kunstmaancms/pagetemplates/';
        } else {
            $dirPath = sprintf('%s/Resources/config/pagetemplates/', $bundle->getPath());
        }

        $skeletonDir = sprintf('%s/Resources/config/pagetemplates/', GeneratorUtils::getFullSkeletonPath('/common'));

        // Only copy templates over when the folder does not exist yet...
        if (!$this->filesystem->exists($dirPath)) {
            $files = array(
                'default-one-column.yml',
                'default-two-column-left.yml',
                'default-two-column-right.yml',
                'default-three-column.yml',
            );
            foreach ($files as $file) {
                $this->filesystem->copy($skeletonDir . $file, $dirPath . $file, false);
                GeneratorUtils::replace('~~~BUNDLE~~~', $bundle->getName(), $dirPath . $file);
            }
        }

        // Twig templates
        $dirPath = $this->getTemplateDir($bundle) . '/Pages/Common/';

        $skeletonDir = sprintf('%s/Resources/views/Pages/Common/', GeneratorUtils::getFullSkeletonPath('/common'));

        if (!$this->filesystem->exists($dirPath)) {
            $files = array(
                'one-column-pagetemplate.html.twig',
                'two-column-left-pagetemplate.html.twig',
                'two-column-right-pagetemplate.html.twig',
                'three-column-pagetemplate.html.twig',
            );
            foreach ($files as $file) {
                $this->filesystem->copy($skeletonDir . $file, $dirPath . $file, false);
            }
            $this->filesystem->copy($skeletonDir . 'view.html.twig', $dirPath . 'view.html.twig', false);
        }

        $contents = file_get_contents($dirPath . 'view.html.twig');

        $twigFile = $this->isSymfony4() ?
            $twigFile = "{% extends 'Layout/layout.html.twig' %}\n" :
            $twigFile = "{% extends '".$bundle->getName().":Layout:layout.html.twig' %}\n"
        ;

        if (strpos($contents, '{% extends ') === false) {
            GeneratorUtils::prepend(
                $twigFile,
                $dirPath . 'view.html.twig'
            );
        }
    }
protected function installDefaultPageTemplates ( $ bundle ) { // Configuration templates if ( $ this -> isSymfony4 ( ) ) { $ dirPath = $ this -> container -> getParameter ( 'kernel.project_dir' ) . '/config/kunstmaancms/pagetemplates/' ; } else { $ dirPath = sprintf ( '%s/Resources/config/pagetemplates/' , $ bundle -> getPath ( ) ) ; } $ skeletonDir = sprintf ( '%s/Resources/config/pagetemplates/' , GeneratorUtils :: getFullSkeletonPath ( '/common' ) ) ; // Only copy templates over when the folder does not exist yet... if ( ! $ this -> filesystem -> exists ( $ dirPath ) ) { $ files = array ( 'default-one-column.yml' , 'default-two-column-left.yml' , 'default-two-column-right.yml' , 'default-three-column.yml' , ) ; foreach ( $ files as $ file ) { $ this -> filesystem -> copy ( $ skeletonDir . $ file , $ dirPath . $ file , false ) ; GeneratorUtils :: replace ( '~~~BUNDLE~~~' , $ bundle -> getName ( ) , $ dirPath . $ file ) ; } } // Twig templates $ dirPath = $ this -> getTemplateDir ( $ bundle ) . '/Pages/Common/' ; $ skeletonDir = sprintf ( '%s/Resources/views/Pages/Common/' , GeneratorUtils :: getFullSkeletonPath ( '/common' ) ) ; if ( ! $ this -> filesystem -> exists ( $ dirPath ) ) { $ files = array ( 'one-column-pagetemplate.html.twig' , 'two-column-left-pagetemplate.html.twig' , 'two-column-right-pagetemplate.html.twig' , 'three-column-pagetemplate.html.twig' , ) ; foreach ( $ files as $ file ) { $ this -> filesystem -> copy ( $ skeletonDir . $ file , $ dirPath . $ file , false ) ; } $ this -> filesystem -> copy ( $ skeletonDir . 'view.html.twig' , $ dirPath . 'view.html.twig' , false ) ; } $ contents = file_get_contents ( $ dirPath . 'view.html.twig' ) ; $ twigFile = $ this -> isSymfony4 ( ) ? $ twigFile = "{% extends 'Layout/layout.html.twig' %}\n" : $ twigFile = "{% extends '" . $ bundle -> getName ( ) . ":Layout:layout.html.twig' %}\n" ; if ( strpos ( $ contents , '{% extends ' ) === false ) { GeneratorUtils :: prepend ( $ twigFile , $ dirPath . 'view.html.twig' ) ; } }
Install the default page templates.

@param BundleInterface $bundle
Install the default page templates .