From f5f5593d79569064c113cfc1b41ea3b70b2725a6 Mon Sep 17 00:00:00 2001 From: Mojmir Fendek Date: Thu, 19 Sep 2024 12:44:26 +1200 Subject: [PATCH] FIX: Correct the save button label. --- src/Form/FormFactory.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Form/FormFactory.php b/src/Form/FormFactory.php index c7bbd85..5c560f2 100644 --- a/src/Form/FormFactory.php +++ b/src/Form/FormFactory.php @@ -4,6 +4,7 @@ use LogicException; use SilverStripe\Admin\Forms\LinkFormFactory; +use SilverStripe\Forms\FormAction; use SilverStripe\Forms\HiddenField; use SilverStripe\ORM\DataObject; @@ -28,6 +29,19 @@ protected function getFormFields($controller, $name, $context) return $fields; } + protected function getFormActions($controller, $name, $context) + { + $actions = parent::getFormActions($controller, $name, $context); + + /** @var FormAction $insertAction */ + $insertAction = $actions->fieldByName('action_insert'); + + // Update action button to be more descriptive + $insertAction?->setTitle(_t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Save', 'Save')); + + return $actions; + } + protected function getValidator($controller, $name, $context) { return null;