Skip to content

Commit

Permalink
Merge pull request #625 from silverstripe-terraformers/feature/copy-a…
Browse files Browse the repository at this point in the history
…ction-extension-points

Copy locale action extension points.
  • Loading branch information
tractorcow authored Jun 22, 2020
2 parents 81eff09 + 5092db1 commit fb6ceb0
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 fb6ceb0

Please sign in to comment.