framework/RedKiteCms/Content/SlotsManager/SlotsManager.php
protected function generateBlocks(array $blocks, $blocksDir, $targetDir)
    {
        $c = 1;
        $generatedBlocks = array();
        foreach ($blocks as $block) {
            $blockName = 'block' . $c;
            $fileName = sprintf('%s/%s.json', $blocksDir, $blockName);
            $generatedBlocks[] = $blockName;

            $value = $block;
            if (is_array($value)) {
                $value = json_encode($block);
            }

            FilesystemTools::writeFile($fileName, $value);
            $c++;
        }

        $slotDefinition = array(
            'next' => $c,
            'blocks' => $generatedBlocks,
            'revision' => 1,
        );
        FilesystemTools::writeFile($targetDir . '/slot.json', json_encode($slotDefinition));
    }
protected function generateBlocks(array $blocks, $blocksDir, $targetDir)
    {
        $c = 1;
        $generatedBlocks = array();
        foreach ($blocks as $block) {
            $blockName = 'block' . $c;
            $fileName = sprintf('%s/%s.json', $blocksDir, $blockName);
            $generatedBlocks[] = $blockName;

            $value = $block;
            if (is_array($value)) {
                $value = json_encode($block);
            }

            FilesystemTools::writeFile($fileName, $value);
            $c++;
        }

        $slotDefinition = array(
            'next' => $c,
            'blocks' => $generatedBlocks,
            'revision' => 1,
        );
        FilesystemTools::writeFile($targetDir . '/slot.json', json_encode($slotDefinition));
    }
protected function generateBlocks ( array $ blocks , $ blocksDir , $ targetDir ) { $ c = 1 ; $ generatedBlocks = array ( ) ; foreach ( $ blocks as $ block ) { $ blockName = 'block' . $ c ; $ fileName = sprintf ( '%s/%s.json' , $ blocksDir , $ blockName ) ; $ generatedBlocks [ ] = $ blockName ; $ value = $ block ; if ( is_array ( $ value ) ) { $ value = json_encode ( $ block ) ; } FilesystemTools :: writeFile ( $ fileName , $ value ) ; $ c ++ ; } $ slotDefinition = array ( 'next' => $ c , 'blocks' => $ generatedBlocks , 'revision' => 1 , ) ; FilesystemTools :: writeFile ( $ targetDir . '/slot.json' , json_encode ( $ slotDefinition ) ) ; }
Generate blocks for the current slot
@param array $blocks
@param string $blocksDir
@param string $targetDir
Generate blocks for the current slot