diff --git a/_config/config.yml b/_config/config.yml index c480278a85..47a7621559 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -4,6 +4,7 @@ Name: cmsextensions SilverStripe\Admin\LeftAndMain: extensions: - SilverStripe\CMS\Controllers\LeftAndMainPageIconsExtension + - SilverStripe\CMS\Controllers\LeftAndMainBatchActionsExtension --- Name: cmsmodals --- diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index db715788fd..df619ea8d0 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -2112,28 +2112,38 @@ public function batchactions() return new CMSBatchActionHandler($this, 'batchactions'); } + /** + * Returns a LiteralField containing parameter field HTML + * for batch actions + * + * Used by {@link LeftAndMain} to render batch actions in + * the BatchActionsForm + * + * @return LiteralField + */ public function BatchActionParameters() { - $batchActions = CMSBatchActionHandler::config()->batch_actions; + $batchActions = $this->batchactions()->registeredActions(); $forms = []; foreach ($batchActions as $urlSegment => $batchAction) { - $SNG_action = singleton($batchAction); - if ($SNG_action->canView() && $fieldset = $SNG_action->getParameterFields()) { + $SNG_action = singleton($batchAction['class']); + if ($SNG_action->canView() && $fieldList = $SNG_action->getParameterFields()) { $formHtml = ''; /** @var FormField $field */ - foreach ($fieldset as $field) { - $formHtml .= $field->Field(); + foreach ($fieldList as $field) { + $formHtml .= $field->FieldHolder(); } $forms[$urlSegment] = $formHtml; } } $pageHtml = ''; foreach ($forms as $urlSegment => $html) { - $pageHtml .= "