From d481ac23faa47f14df9320471bebc57352f3ca70 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 12 Nov 2024 13:25:50 +1300 Subject: [PATCH] API Rename method --- code/elemental/ElementContentExtension.php | 2 +- code/elemental/NumericFieldExtension.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/elemental/ElementContentExtension.php b/code/elemental/ElementContentExtension.php index a517a50..7a162a6 100644 --- a/code/elemental/ElementContentExtension.php +++ b/code/elemental/ElementContentExtension.php @@ -28,7 +28,7 @@ class ElementContentExtension extends Extension 'MyFile' => File::class, ]; - protected function updatevalidate(ValidationResult $result) + protected function updateValidate(ValidationResult $result) { if ($this->owner->Title == 'x') { $result->addFieldError('Title', 'Title cannot be x'); diff --git a/code/elemental/NumericFieldExtension.php b/code/elemental/NumericFieldExtension.php index 358c8e8..fd8e421 100644 --- a/code/elemental/NumericFieldExtension.php +++ b/code/elemental/NumericFieldExtension.php @@ -4,16 +4,17 @@ use SilverStripe\Forms\NumericField; use SilverStripe\Core\Extension; +use SilverStripe\Core\Validation\ValidationResult; /** * @extends Extension */ class NumericFieldExtension extends Extension { - protected function updateValidationResult($result, $validator) + protected function updateValidate(ValidationResult $result) { if ($this->owner->Value() == 1) { - $validator->validationError($this->owner->getName(), 'This field cannot be 1'); + $result->addFieldError($this->owner->getName(), 'This field cannot be 1'); } } }