first
This commit is contained in:
@ -209,11 +209,11 @@ class EntityRelation
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAdditionalPropertyByEntityId(string $entity, string $entity_id, string $additionalPropertySlug): string
|
||||
public function getAdditionalPropertyByEntityId(string $entity, string $entity_id, string $additionalPropertySlug, array $params = []): string
|
||||
{
|
||||
$moduleClass = $this->getAdditionalPropertyClassBySlug($additionalPropertySlug);
|
||||
if ($moduleClass and method_exists($moduleClass, "getItem")) {
|
||||
return $moduleClass->getItem($entity, $entity_id);
|
||||
return $moduleClass->getItem($entity, $entity_id, $params);
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -276,4 +276,20 @@ class EntityRelation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function callModuleMethod(string $slug, string $method, array $params)
|
||||
{
|
||||
$module = $this->moduleService->getModuleInfoBySlug($slug);
|
||||
if (isset($module['module_class'])) {
|
||||
$moduleClass = new $module['module_class']();
|
||||
if (method_exists($moduleClass, $method)) {
|
||||
|
||||
return call_user_func_array([$moduleClass, $method], $params);
|
||||
} else {
|
||||
echo "Метод $method не существует";
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user