Skip to content

Commit

Permalink
Copy locale action extension points.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfendeksilverstripe committed Jun 19, 2020
1 parent 81eff09 commit 5092db1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Forms/CopyLocaleAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
}
$destinationState->setLocale($toLocale->getLocale());

$fromLocale = $arguments['FromLocale'];
$toLocale = $arguments['ToLocale'];
$record->invokeWithExtensions('onBeforeCopyLocale', $fromLocale, $toLocale);

// Write
/** @var DataObject|Versioned $record */
if ($record->hasExtension(Versioned::class)) {
Expand All @@ -114,6 +118,8 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
$record->forceChange();
$record->write();
}

$record->invokeWithExtensions('onAfterCopyLocale', $fromLocale, $toLocale);
});
});
}
Expand Down

0 comments on commit 5092db1

Please sign in to comment.