silverstripe-frameworktest/code/elemental/NumericFieldExtension.php
2024-03-06 16:15:41 +13:00

20 lines
451 B
PHP

<?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');
}
}
}