mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
20 lines
451 B
PHP
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');
|
|
}
|
|
}
|
|
}
|