Skip to content

Commit

Permalink
fix: Use publishRecursive() to publish an Item from the gridfield a…
Browse files Browse the repository at this point in the history
…llowing for SS5 compatibility
  • Loading branch information
mleutenegger committed Apr 19, 2024
1 parent 32826ca commit b795ae4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Forms/GridFieldPublishAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
/** @var \SilverStripe\ORM\DataList */
$list = $gridField->getList();
$item = $list->byID($arguments['RecordID']);
$item->doPublish();

try {
$item->doPublish();
} catch (\Exception $e) {
$item->publishRecursive();
}

// output a success message to the user
Controller::curr()->getResponse()->setStatusCode(
Expand Down

0 comments on commit b795ae4

Please sign in to comment.