Skip to content

Commit

Permalink
Allows set named views in ContentDecorator::$viewFile
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSilence authored Oct 15, 2022
1 parent c2d98f2 commit 089463e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions framework/widgets/ContentDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
* [[\yii\base\View]] component to make syntax more friendly. In the view these could be used as follows:
*
* ```php
* <?php $this->beginContent('@app/views/layouts/base.php') ?>
*
* some content here
*
* <?php $this->beginContent('main') ?>
* <aside id="sidebar-left">...</aside>
* <main id="main-content">
* <?= $content ?>
* </main>
* <?php $this->endContent() ?>
* ```
*
Expand Down Expand Up @@ -76,6 +77,6 @@ public function run()
$params = $this->params;
$params['content'] = ob_get_clean();
// render under the existing context
echo $this->view->renderFile($this->viewFile, $params);
echo $this->view->render($this->viewFile, $params);
}
}

0 comments on commit 089463e

Please sign in to comment.