/** * @param EE_Registration $registration * @param EE_Question $question * @param mixed EE_Answer|NULL $answer * @return EE_Form_Input_Base */ private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); $this->_required_questions[$identifier] = $question->required() ? true : false; add_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'), 10, 4); add_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'), 10, 4); $input_constructor_args = array('html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, 'html_label_class' => 'ee-reg-qstn'); $input_constructor_args['html_label_id'] .= '-lbl'; if ($answer instanceof EE_Answer && $answer->ID()) { $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; $input_constructor_args['html_id'] .= '-' . $answer->ID(); $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); } $form_input = $question->generate_form_input($registration, $answer, $input_constructor_args); remove_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input')); remove_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input')); return $form_input; }