silverstripe-frameworktest/code/elemental/NumericFieldExtension.php

20 lines
451 B
PHP
Raw Normal View History

2024-03-06 04:15:41 +01:00
<?php
namespace SilverStripe\FrameworkTest\Elemental\Extension;
use SilverStripe\Forms\NumericField;
use SilverStripe\Core\Extension;
/**
* @extends Extension<NumericField>
*/
class NumericFieldExtension extends Extension
{
public function updateValidationResult($result, $validator)
{
if ($this->owner->Value() == 1) {
$validator->validationError($this->owner->getName(), 'This field cannot be 1');
}
}
}