mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
CMSMain - Fixed and enhanced BatchActionParameters
+ Fixed the $batchActions variable by making it use the `registeredActions()` method + Made the loop use `FieldHolder` instead of `Field` so CMS fields display correctly + Added hidden styles to the batch action div for jQuery show/hide functionality (found in Admin module PR)
This commit is contained in:
parent
d304ba9963
commit
81593057de
@ -2114,23 +2114,23 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
public function BatchActionParameters()
|
public function BatchActionParameters()
|
||||||
{
|
{
|
||||||
$batchActions = CMSBatchActionHandler::config()->batch_actions;
|
$batchActions = $this->batchactions()->registeredActions();
|
||||||
|
|
||||||
$forms = [];
|
$forms = [];
|
||||||
foreach ($batchActions as $urlSegment => $batchAction) {
|
foreach ($batchActions as $urlSegment => $batchAction) {
|
||||||
$SNG_action = singleton($batchAction);
|
$SNG_action = singleton($batchAction["class"]);
|
||||||
if ($SNG_action->canView() && $fieldset = $SNG_action->getParameterFields()) {
|
if ($SNG_action->canView() && $fieldList = $SNG_action->getParameterFields()) {
|
||||||
$formHtml = '';
|
$formHtml = '';
|
||||||
/** @var FormField $field */
|
/** @var FormField $field */
|
||||||
foreach ($fieldset as $field) {
|
foreach ($fieldList as $field) {
|
||||||
$formHtml .= $field->Field();
|
$formHtml .= $field->FieldHolder();
|
||||||
}
|
}
|
||||||
$forms[$urlSegment] = $formHtml;
|
$forms[$urlSegment] = $formHtml;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pageHtml = '';
|
$pageHtml = '';
|
||||||
foreach ($forms as $urlSegment => $html) {
|
foreach ($forms as $urlSegment => $html) {
|
||||||
$pageHtml .= "<div class=\"params\" id=\"BatchActionParameters_$urlSegment\">$html</div>\n\n";
|
$pageHtml .= "<div class=\"params\" id=\"BatchActionParameters_$urlSegment\" style=\"display:none\">$html</div>\n\n";
|
||||||
}
|
}
|
||||||
return new LiteralField("BatchActionParameters", '<div id="BatchActionParameters" style="display:none">'.$pageHtml.'</div>');
|
return new LiteralField("BatchActionParameters", '<div id="BatchActionParameters" style="display:none">'.$pageHtml.'</div>');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user