From 18d2bda75ab79bed27586d37be38c4e85c41b7e6 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 23 Apr 2023 20:56:00 +0200 Subject: [PATCH] remove magic --- src/BackendBehaviors.php | 61 +++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/src/BackendBehaviors.php b/src/BackendBehaviors.php index 6fe0f6f..c80330f 100644 --- a/src/BackendBehaviors.php +++ b/src/BackendBehaviors.php @@ -68,19 +68,25 @@ class BackendBehaviors ); echo - (new Form('plocd'))->method('post')->action($pa->getURI())->fields([ - (new Text('', $pa->getCheckboxes())), - (new Text('p', __('Are you sure you want to delete all comments?'))), - (new Para())->items(array_merge( - [ - (new Submit(['do']))->value(__('yes')), - dcCore::app()->formNonce(false), - (new Hidden(['action'], 'commentsdelete')), - (new Hidden(['confirmdeletecomments'], '1')), - ], - $pa->hiddenFields(), - )), - ])->render(); + (new Form('plocd')) + ->__call('method', ['post']) + ->__call('action', [$pa->getURI()]) + ->__call('fields', [[ + (new Text('', $pa->getCheckboxes())), + (new Text('p', __('Are you sure you want to delete all comments?'))), + (new Para()) + ->__call('items', [array_merge( + [ + (new Submit(['do'])) + ->__call('value', [__('yes')]), + dcCore::app()->formNonce(false), + (new Hidden(['action'], 'commentsdelete')), + (new Hidden(['confirmdeletecomments'], '1')), + ], + $pa->hiddenFields(), + )]), + ]]) + ->render(); $pa->endPage(); } else { @@ -130,19 +136,22 @@ class BackendBehaviors ); echo - (new Form('plotd'))->method('post')->action($pa->getURI())->fields([ - (new Text('', $pa->getCheckboxes())), - (new Text('p', __('Are you sure you want to delete all trackbacks?'))), - (new Para())->items(array_merge( - [ - (new Submit(['do']))->value(__('yes')), - dcCore::app()->formNonce(false), - (new Hidden(['action'], 'trackbacksdelete')), - (new Hidden(['confirmdeletetrackbacks'], '1')), - ], - $pa->hiddenFields(), - )), - ])->render(); + (new Form('plotd')) + ->__call('method', ['post']) + ->__call('action', [$pa->getURI()]) + ->__call('fields', [[ + (new Text('', $pa->getCheckboxes())), + (new Text('p', __('Are you sure you want to delete all trackbacks?'))), + (new Para()) + ->__call('items', [array_merge([ + (new Submit(['do'])) + ->__call('value', [__('yes')]), + dcCore::app()->formNonce(false), + (new Hidden(['action'], 'trackbacksdelete')), + (new Hidden(['confirmdeletetrackbacks'], '1')), + ], $pa->hiddenFields())]), + ]]) + ->render(); $pa->endPage(); } else {