use new addBehaviors method

This commit is contained in:
Jean-Christian Paul Denis 2023-01-30 21:19:21 +01:00
parent 82a006a2e2
commit 1d58b6cf8c
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -53,9 +53,8 @@ class Admin
return false;
}
dcCore::app()->addBehavior(
'adminModulesListGetActions',
function ($list, $id, $_) {
dcCore::app()->addBehaviors([
'adminModulesListGetActions' => function ($list, $id, $_) {
return in_array($list->getList(), [
'plugin-activate',
'theme-activate',
@ -64,12 +63,8 @@ class Admin
basename(__DIR__),
html::escapeHTML($id)
) : null;
}
);
dcCore::app()->addBehavior(
'adminModulesListDoActions',
function ($list, $modules, $type) {
},
'adminModulesListDoActions' => function ($list, $modules, $type) {
# Pack action
if (empty($_POST[basename(__DIR__)])
|| !is_array($_POST[basename(__DIR__)])) {
@ -143,8 +138,8 @@ class Admin
__('Task successfully executed.')
);
http::redirect($list->getURL());
}
);
},
]);
return true;
}