/** * Checks if this form section itself is valid, and then checks its subsections * @throws EE_Error * @return boolean */ public function is_valid() { if (!$this->has_received_submission()) { throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso"))); } if (!parent::is_valid()) { return false; } //ok so no errors general to this entire form section. so let's check the subsections foreach ($this->get_validatable_subsections() as $subsection) { if (!$subsection->is_valid() || $subsection->get_validation_error_string() !== '') { $this->set_submission_error_message($subsection->get_validation_error_string()); return false; } } return true; }