1
0
Fork 0
feedizer-php/htdocs/libraries/Nibble-Forms/Nibble/NibbleForms/Field/Options.php

25 lines
500 B
PHP
Raw Permalink Normal View History

2015-11-13 23:51:46 +01:00
<?php
namespace Nibble\NibbleForms\Field;
use Nibble\NibbleForms\Useful;
abstract class Options extends BaseOptions
{
public function validate($val)
{
if ($this->required) {
if (Useful::stripper($val) === false) {
$this->error[] = 'is required';
}
}
if (in_array($val, $this->false_values)) {
$this->error[] = "$val is not a valid choice";
}
return !empty($this->error) ? false : true;
}
}