예제 #1
0
파일: Section.php 프로젝트: pr-of-it/t4
 public function render()
 {
     $id = $this->params->id;
     $app = Application::instance();
     $blocks = \App\Models\Block::findAllBySection($id, ['order' => '`order`']);
     $ret = '<section role="section" data-section-id="' . $id . '">' . "\n";
     foreach ($blocks as $block) {
         try {
             $content = $app->callBlock($block->path, $block->template, new Std(json_decode($block->options, true)));
         } catch (Exception $e) {
             $content = $e->getMessage();
         }
         $ret .= '<article role="block" data-block-id="' . $block->getPk() . '">' . $content . '</article>' . "\n";
     }
     return $ret . '</section>' . "\n";
 }