Commit 4023f421 by Alexander Makarov

Allow writing widgets using return instead of echo in the run method to make it…

Allow writing widgets using return instead of echo in the run method to make it consistent with controller
parent 698d66a2
......@@ -93,8 +93,13 @@ class Widget extends Component implements ViewContextInterface
/** @var Widget $widget */
$config['class'] = get_called_class();
$widget = Yii::createObject($config);
$widget->run();
return ob_get_clean();
$out = $widget->run();
if (empty($out)) {
return ob_get_clean();
} else {
ob_clean();
return $out;
}
}
private $_id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment