silverstripe-frameworktest/code/elemental/NumericFieldExtension.php

20 lines
454 B
PHP
Raw Permalink 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
{
protected function updateValidationResult($result, $validator)
2024-03-06 04:15:41 +01:00
{
if ($this->owner->Value() == 1) {
$validator->validationError($this->owner->getName(), 'This field cannot be 1');
}
}
}