REFACTORING #1880 @4h30m: another ugly refactoring commit
This commit is contained in:
@@ -36,8 +36,8 @@ class Module extends Repository implements IModule
|
||||
|
||||
public function getUpdateContentTitle(ModuleModel $module, Content $content = null)
|
||||
{
|
||||
$pageHeading = trans('admin/contents.new', ['name' => trans($module->name)]);
|
||||
$moduleHeading = $this->call($module, 'getEditTitle', $content);
|
||||
$pageHeading = trans('admin/contents.edit', ['name' => trans($module->name)]);
|
||||
$moduleHeading = $this->call($module, 'getEditTitle', [$content]);
|
||||
|
||||
return is_null($moduleHeading) ? $pageHeading : $moduleHeading;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class Module extends Repository implements IModule
|
||||
->firstOrFail();
|
||||
}
|
||||
|
||||
public function call(ModuleModel $module, $method, ...$parameters)
|
||||
public function call(ModuleModel $module, $method, $parameters = [])
|
||||
{
|
||||
if (!is_null($module) && is_callable([$module->handler, $method])) {
|
||||
return call_user_func_array([$module->handler, $method], $parameters);
|
||||
@@ -70,4 +70,13 @@ class Module extends Repository implements IModule
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function callOnString($moduleHandler, $method, $parameters = [])
|
||||
{
|
||||
if (is_callable([$moduleHandler, $method])) {
|
||||
return call_user_func_array([$moduleHandler, $method], $parameters);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user