public static function widget($config = [])
{
ob_start();
ob_implicit_flush(false);
try {
/* @var $widget Widget */
$config['class'] = get_called_class();
$widget = Yii::createObject($config);
$out = $widget->run();
} catch (\Exception $e) {
// close the output buffer opened above if it has not been closed already
if (ob_get_level() > 0) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean() . $out;
}
public static function widget($config = []) { if (isset($config['options'])) { $options =& $config['options']; } $vars = get_class_vars(get_class()); foreach ($config as $k => $v) { if (array_key_exists($k, $vars)) { continue; } $options[$k] = $v; unset($config[$k]); } return parent::widget($config); }