123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace yii\widgets;
- use yii\base\InvalidConfigException;
- use yii\base\Widget;
- class ContentDecorator extends Widget
- {
-
- public $viewFile;
-
- public $params = [];
-
- public function init()
- {
- parent::init();
- if ($this->viewFile === null) {
- throw new InvalidConfigException('ContentDecorator::viewFile must be set.');
- }
- ob_start();
- ob_implicit_flush(false);
- }
-
- public function run()
- {
- $params = $this->params;
- $params['content'] = ob_get_clean();
-
- echo $this->view->renderFile($this->viewFile, $params);
- }
- }
|