addBehavior('adminPostsActions', function (ActionsPosts $pa) { $pa->addAction( [ __('Comments') => [ __('Mark as opened') => 'commentsopen', __('Mark as closed') => 'commentsclose', __('Delete all comments') => 'commentsdelete', ], __('Trackbacks') => [ __('Mark as opened') => 'trackbacksopen', __('Mark as closed') => 'trackbacksclose', __('Delete all trackbacks') => 'trackbacksdelete', ], ], function (ActionsPosts $pa, ArrayObject $post) { $actions = [ 'commentsopen', 'commentsclose', 'commentsdelete', 'trackbacksopen', 'trackbacksclose', 'trackbacksdelete', ]; if (in_array($pa->getAction(), $actions)) { BackendBehaviors::{$pa->getAction()}($pa, $post); } } ); }); return true; } }