Example #1
0
 public function getLayoutBlocks()
 {
     // Load the page YAML structure
     $page_def = yaml_parse_file($this->getPageDefFile());
     // Get page layout if defined and check if the YAML file for the given layout exists
     $layout = false;
     if (!strlen($page_def['layout'])) {
         $page_def['layout'] = 'default';
     }
     $layoutFileName = $this->context->getLayoutsHome() . $page_def['layout'] . '.local.yml';
     if (file_exists($layoutFileName)) {
         $layout = true;
     } else {
         $layoutFileName = $this->context->getLayoutsHome() . $page_def['layout'] . '.yml';
         if (file_exists($layoutFileName)) {
             $layout = true;
         }
     }
     if ($layout) {
         // Load the layout YAML structure
         $layout_def = yaml_parse_file($layoutFileName);
         $blocks = array();
         // Get block list
         foreach ($layout_def['blocks'] as $blockDef) {
             $blocks[] = $blockDef;
         }
         return $blocks;
     }
     return false;
 }