* zin: support use functin to define widget

This commit is contained in:
Hao Sun
2023-02-15 16:42:22 +08:00
parent 75c4a68415
commit e7ecd6b7f6
+7 -2
View File
@@ -47,7 +47,12 @@ function createWg($name, $args)
include_once $app->getBasePath() . 'zin' . DS . 'wg' . DS . $name . DS . "v$wgVer.php";
$className = "\\zin\\$name";
$wgName = "\\zin\\$name";
return class_exists($className) ? (new $className($args)) : $className($args);
if(method_exists($wgName, 'create'))
{
return call_user_func_array($wgName, $args);
}
return class_exists($wgName) ? (new $wgName($args)) : $apiName($args);
}