hasOption('reference')) { throw new common_Exception(sprintf("No reference provided for %s validator", $this->getName())); } } public function evaluate($values) { $isEmpty = [empty($values)]; foreach ($this->references as $reference) { $isEmpty[] = empty($reference->getRawValue()); } return count(array_filter($isEmpty)) === 1; } public function acknowledge(tao_helpers_form_Form $form): void { $message = []; foreach ($this->getOption('reference', []) as $ref) { $ref = $ref instanceof tao_helpers_form_FormElement ? $ref : $form->getElement( tao_helpers_Uri::encode($ref) ); $this->references[] = $ref; $message[] = $ref->getDescription(); } $this->setMessage(__('Only one of the field must have value %s', implode(',', $message))); } }