use new addBehaviors method

master
Jean-Christian Paul Denis 2023-01-30 21:19:21 +01:00
parent 82a006a2e2
commit 1d58b6cf8c
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 6 additions and 11 deletions

View File

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