/** * {@inheritdoc} */ public function validate($values, \sndsgd\form\Validator $validator) { if (!$this->validateCollection("array", $values, $validator)) { return []; } $ret = []; foreach (array_values($values) as $index => $value) { $result = $this->valueField->setName($index)->validate($value, $validator); if (!is_null($result)) { $ret[] = $result; } } return $ret; }
/** * @return array<string,mixed> */ public function toArray() : array { return ["name" => $this->field->getName(), "type" => $this->getType(), "signature" => $this->getSignature(), "description" => $this->field->getDescription(), "default" => $this->field->getDefaultValue(), "rules" => array_filter(["keys" => $this->getKeyRules(), "values" => array_merge($this->getValueRules(), $this->getFieldRules())])]; }