Support calling namespaced class in trigger

This commit is contained in:
Kijin Sung 2021-12-13 15:21:42 +09:00
parent eb10708a88
commit 51173863c1

View file

@ -1249,8 +1249,20 @@ class ModuleHandler extends Handler
$type = $item->type;
$called_method = $item->called_method;
// todo why don't we call a normal class object ?
$oModule = getModule($module, $type);
// Get instance of module class
if (strpos($type, '\\') !== false)
{
$class_name = sprintf('Rhymix\\Modules\\%s\\%s', $module, $type);
if (class_exists($class_name))
{
$oModule = $class_name::getInstance();
}
}
else
{
$oModule = getModule($module, $type);
}
if(!$oModule || !method_exists($oModule, $called_method))
{
continue;