framework/RedKiteCms/Content/Theme/ThemeSlotsGenerator.php
public function generate()
    {
        $templates = array_merge(array_keys($this->templates["base"]), array_keys($this->templates["template"]));
        foreach($templates as $template) {
            $templateDir = $this->themeDir . '/' . $template;
            if (!is_dir($templateDir)) {
                continue;
            }
            $finder = new Finder();
            $files = $finder->files()->depth(0)->in($templateDir);
            foreach ($files as $file) {
                $file = (string)$file;
                $slotName = basename($file, '.json');
                $json = FilesystemTools::readFile($file);
                $slot = json_decode($json, true);

                $blocks = array();
                if (array_key_exists("blocks", $slot)) {
                    $blocks = $slot["blocks"];
                }

                $slotManager = $this->slotsManagerFactory->createSlotManager($slot["repeat"]);
                $slotManager->addSlot($slotName, $blocks);
            }
        }
    }
public function generate()
    {
        $templates = array_merge(array_keys($this->templates["base"]), array_keys($this->templates["template"]));
        foreach($templates as $template) {
            $templateDir = $this->themeDir . '/' . $template;
            if (!is_dir($templateDir)) {
                continue;
            }
            $finder = new Finder();
            $files = $finder->files()->depth(0)->in($templateDir);
            foreach ($files as $file) {
                $file = (string)$file;
                $slotName = basename($file, '.json');
                $json = FilesystemTools::readFile($file);
                $slot = json_decode($json, true);

                $blocks = array();
                if (array_key_exists("blocks", $slot)) {
                    $blocks = $slot["blocks"];
                }

                $slotManager = $this->slotsManagerFactory->createSlotManager($slot["repeat"]);
                $slotManager->addSlot($slotName, $blocks);
            }
        }
    }
public function generate ( ) { $ templates = array_merge ( array_keys ( $ this -> templates [ "base" ] ) , array_keys ( $ this -> templates [ "template" ] ) ) ; foreach ( $ templates as $ template ) { $ templateDir = $ this -> themeDir . '/' . $ template ; if ( ! is_dir ( $ templateDir ) ) { continue ; } $ finder = new Finder ( ) ; $ files = $ finder -> files ( ) -> depth ( 0 ) -> in ( $ templateDir ) ; foreach ( $ files as $ file ) { $ file = ( string ) $ file ; $ slotName = basename ( $ file , '.json' ) ; $ json = FilesystemTools :: readFile ( $ file ) ; $ slot = json_decode ( $ json , true ) ; $ blocks = array ( ) ; if ( array_key_exists ( "blocks" , $ slot ) ) { $ blocks = $ slot [ "blocks" ] ; } $ slotManager = $ this -> slotsManagerFactory -> createSlotManager ( $ slot [ "repeat" ] ) ; $ slotManager -> addSlot ( $ slotName , $ blocks ) ; } } }
Generates the slots from the web site that handles the theme into the Theme slots
Generates the slots from the web site that handles the theme into the Theme slots