group combo and use anonymous function

This commit is contained in:
Jean-Christian Paul Denis 2022-12-23 18:21:38 +01:00
parent fe6c9a520b
commit 7954de4037
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -23,49 +23,28 @@ dcCore::app()->addBehavior('adminPostsActions', function (dcPostsActions $pa) {
[ [
__('Comments') => [ __('Comments') => [
__('Mark as opened') => 'commentsopen', __('Mark as opened') => 'commentsopen',
],
],
['behaviorsPostlistOptions', 'commentsOpen']
);
$pa->addAction(
[
__('Comments') => [
__('Mark as closed') => 'commentsclose', __('Mark as closed') => 'commentsclose',
],
],
['behaviorsPostlistOptions', 'commentsClose']
);
$pa->addAction(
[
__('Comments') => [
__('Delete all comments') => 'commentsdelete', __('Delete all comments') => 'commentsdelete',
], ],
],
['behaviorsPostlistOptions', 'commentsDelete']
);
$pa->addAction(
[
__('Trackbacks') => [ __('Trackbacks') => [
__('Mark as opened') => 'trackbacksopen', __('Mark as opened') => 'trackbacksopen',
],
],
['behaviorsPostlistOptions', 'trackbacksOpen']
);
$pa->addAction(
[
__('Trackbacks') => [
__('Mark as closed') => 'trackbacksclose', __('Mark as closed') => 'trackbacksclose',
],
],
['behaviorsPostlistOptions', 'trackbacksClose']
);
$pa->addAction(
[
__('Trackbacks') => [
__('Delete all trackbacks') => 'trackbacksdelete', __('Delete all trackbacks') => 'trackbacksdelete',
], ],
], ],
['behaviorsPostlistOptions', 'trackbacksDelete'] function (dcPostsActions $pa, ArrayObject $post) {
$actions = [
'commentsopen',
'commentsclose',
'commentsdelete',
'trackbacksopen',
'trackbacksclose',
'trackbacksdelete',
];
if (in_array($pa->getAction(), $actions)) {
behaviorsPostlistOptions::{$pa->getAction()}($pa, $post);
}
}
); );
}); });