public function setValidator($validator = null) { if (count($this->getValidators()) === 0 && $validator instanceof FormHandler\Validator\FunctionCallable && is_array($validator->getCallable())) { $callable = $validator->getCallable(); //detect if it is an optional validator if ($callable[0] instanceof Validator && substr($callable[1], 0, 1) !== '_') { parent::setValidator(new \FormHandler\Validator\NotEmpty()); } } return parent::setValidator(FormHandler::parseValidator($validator, $this)); }
/** * FormHandler::editor() * * Create a editor on the form * * @param string $title The title of the field * @param string $name The name of the field * @param string $validator The validator which should be used to validate the value of the field * @param string $path Path on the server where we have to upload the files * @param string $toolbar The toolbar we have to use * @param string $skin The skin to use * @param int $width The width of the field * @param int $height The height of the field * @param boolean $useArrayKeyAsValue If the array key's are the values for the options in the field * @param string $extra CSS, Javascript or other which are inserted into the HTML tag * @return \FormHandler\Field\TextArea * @author Teye Heimans * @deprecated No alternative exist */ public function editor($title, $name, $validator = null, $path = null, $toolbar = null, $skin = null, $width = null, $height = null, $config = null) { return \FormHandler\Field\TextArea::set($this, $title, $name, $validator); }