mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
Support custom classes in module.xml
This commit is contained in:
parent
45efb781ea
commit
62d9befb0d
2 changed files with 41 additions and 6 deletions
|
|
@ -81,6 +81,7 @@ class ModuleActionParser extends BaseParser
|
|||
// Parse permissions.
|
||||
$action_name = trim($action['name']);
|
||||
$action_type = trim($action['type']);
|
||||
$action_class = trim($action['class']);
|
||||
$permission = trim($action['permission']);
|
||||
$permission_info = (object)['target' => '', 'check_var' => '', 'check_type' => ''];
|
||||
if ($permission)
|
||||
|
|
@ -133,9 +134,27 @@ class ModuleActionParser extends BaseParser
|
|||
}
|
||||
}
|
||||
|
||||
// Automatically determine the type for custom classes.
|
||||
if ($action_class && !$action_type)
|
||||
{
|
||||
if (starts_with('disp', $action_name))
|
||||
{
|
||||
$action_type = 'view';
|
||||
}
|
||||
elseif (starts_with('proc', $action_name))
|
||||
{
|
||||
$action_type = 'controller';
|
||||
}
|
||||
else
|
||||
{
|
||||
$action_type = 'auto';
|
||||
}
|
||||
}
|
||||
|
||||
// Parse other information about this action.
|
||||
$action_info = new \stdClass;
|
||||
$action_info->type = $action_type;
|
||||
$action_info->class_name = preg_replace('/\\\\+/', '\\\\', $action_class);
|
||||
$action_info->grant = trim($action['grant']) ?: 'guest';
|
||||
$action_info->permission = $permission_info;
|
||||
$action_info->ruleset = trim($action['ruleset']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue