/**
     * Back-end widget form.
     *
     * @see WP_Widget::form()
     *
     * @param array $instance Previously saved values from database.
     * @return string|void
     */
    public function form($instance)
    {
        EE_Registry::instance()->load_helper('Form_Fields');
        EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
        // Set up some default widget settings.
        $defaults = array('title' => 'New_Addon');
        $instance = wp_parse_args((array) $instance, $defaults);
        add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
        $yes_no_values = array(EE_Question_Option::new_instance(array('QSO_value' => 0, 'QSO_desc' => __('No', 'event_espresso'))), EE_Question_Option::new_instance(array('QSO_value' => 1, 'QSO_desc' => __('Yes', 'event_espresso'))));
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				<?php 
        _e('Title:', 'event_espresso');
        ?>
			</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" width="20" value="<?php 
        echo $instance['title'];
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('yes_or_no_question');
        ?>
">
				<?php 
        _e('Yes or No?', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Yes or No?', 'event_espresso'), $instance['yes_or_no_question'], $yes_no_values, $this->get_field_name('yes_or_no_question'), $this->get_field_id('yes_or_no_question'));
        ?>
		</p>
<?php 
    }
    /**
     * Back-end widget form.
     *
     * @see WP_Widget::form()
     * @param array $instance Previously saved values from database.
     * @return string|void
     */
    public function form($instance)
    {
        EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
        // Set up some default widget settings.
        $defaults = array('title' => __('Upcoming Events', 'event_espresso'), 'category_name' => '', 'show_expired' => FALSE, 'show_desc' => TRUE, 'show_dates' => TRUE, 'show_everywhere' => FALSE, 'date_limit' => 2, 'limit' => 10, 'date_range' => FALSE, 'image_size' => 'medium');
        $instance = wp_parse_args((array) $instance, $defaults);
        // don't add HTML labels for EE_Form_Fields generated inputs
        add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
        $yes_no_values = array(EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))));
        ?>

		<!-- Widget Title: Text Input -->

		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				<?php 
        _e('Title:', 'event_espresso');
        ?>
			</label>
			<input id="<?php 
        echo $this->get_field_id('title');
        ?>
" class="widefat" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" type="text" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('category_name');
        ?>
">
				<?php 
        _e('Event Category:', 'event_espresso');
        ?>
			</label>
			<?php 
        $event_categories = array();
        /** @type EEM_Term $EEM_Term */
        $EEM_Term = EE_Registry::instance()->load_model('Term');
        $categories = $EEM_Term->get_all_ee_categories(TRUE);
        if ($categories) {
            foreach ($categories as $category) {
                if ($category instanceof EE_Term) {
                    $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name')));
                }
            }
        }
        array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso'))));
        echo EEH_Form_Fields::select(__('Event Category:', 'event_espresso'), $instance['category_name'], $event_categories, $this->get_field_name('category_name'), $this->get_field_id('category_name'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('limit');
        ?>
">
				<?php 
        _e('Number of Events to Display:', 'event_espresso');
        ?>
			</label>
			<input id="<?php 
        echo $this->get_field_id('limit');
        ?>
" name="<?php 
        echo $this->get_field_name('limit');
        ?>
" value="<?php 
        echo $instance['limit'];
        ?>
" size="3" type="text" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_expired');
        ?>
">
				<?php 
        _e('Show Expired Events:', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Show Expired Events:', 'event_espresso'), $instance['show_expired'], $yes_no_values, $this->get_field_name('show_expired'), $this->get_field_id('show_expired'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('image_size');
        ?>
">
				<?php 
        _e('Image Size:', 'event_espresso');
        ?>
			</label>
			<?php 
        $image_sizes = array();
        $sizes = get_intermediate_image_sizes();
        if ($sizes) {
            // loop thru images and create option objects out of them
            foreach ($sizes as $image_size) {
                $image_size = trim($image_size);
                // no big images plz
                if (!in_array($image_size, array('large', 'post-thumbnail'))) {
                    $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size));
                }
            }
            $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso')));
        }
        echo EEH_Form_Fields::select(__('Image Size:', 'event_espresso'), $instance['image_size'], $image_sizes, $this->get_field_name('image_size'), $this->get_field_id('image_size'));
        ?>

		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_desc');
        ?>
">
				<?php 
        _e('Show Description:', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Show Description:', 'event_espresso'), $instance['show_desc'], $yes_no_values, $this->get_field_name('show_desc'), $this->get_field_id('show_desc'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_dates');
        ?>
">
				<?php 
        _e('Show Dates:', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Show Dates:', 'event_espresso'), $instance['show_dates'], $yes_no_values, $this->get_field_name('show_dates'), $this->get_field_id('show_dates'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_everywhere');
        ?>
">
		        <?php 
        _e('Show on all Pages:', 'event_espresso');
        ?>
			</label>
	 	    <?php 
        echo EEH_Form_Fields::select(__('Show on all Pages:', 'event_espresso'), $instance['show_everywhere'], $yes_no_values, $this->get_field_name('show_everywhere'), $this->get_field_id('show_everywhere'));
        ?>
	 	</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('date_limit');
        ?>
">
				<?php 
        _e('Number of Dates to Display:', 'event_espresso');
        ?>
			</label>
			<input id="<?php 
        echo $this->get_field_id('date_limit');
        ?>
" name="<?php 
        echo $this->get_field_name('date_limit');
        ?>
" value="<?php 
        echo esc_attr($instance['date_limit']);
        ?>
" size="3" type="text" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('date_range');
        ?>
">
				<?php 
        _e('Show Date Range:', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Show Date Range:', 'event_espresso'), $instance['date_range'], $yes_no_values, $this->get_field_name('date_range'), $this->get_field_id('date_range'));
        ?>
<span class="description"><br /><?php 
        _e('This setting will replace the list of dates in the widget.', 'event_espresso');
        ?>
</span>
		</p>

		<?php 
    }
    /**
     * Back-end widget form.
     *
     * @see WP_Widget::form()
     *
     * @param array $instance Previously saved values from database.
     * @return string|void
     */
    public function form($instance)
    {
        EE_Registry::instance()->load_helper('Form_Fields');
        EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
        // Set up some default widget settings.
        $defaults = array('title' => 'Calendar', 'show_expired' => FALSE, 'category_id' => '', 'calendar_page' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
        $yes_no_values = array(EE_Question_Option::new_instance(array('QSO_value' => 0, 'QSO_desc' => __('No', 'event_espresso'))), EE_Question_Option::new_instance(array('QSO_value' => 1, 'QSO_desc' => __('Yes', 'event_espresso'))));
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				<?php 
        _e('Title:', 'event_espresso');
        ?>
			</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" width="20" value="<?php 
        echo $instance['title'];
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_expired');
        ?>
">
				<?php 
        _e('Display Expired Events?', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Display Expired Events?', 'event_espresso'), $instance['show_expired'], $yes_no_values, $this->get_field_name('show_expired'), $this->get_field_id('show_expired'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('category_id');
        ?>
">
				<?php 
        _e('Single Category Name (optional)', 'event_espresso');
        ?>
			</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('category_id');
        ?>
" name="<?php 
        echo $this->get_field_name('category_id');
        ?>
" width="20" value="<?php 
        echo $instance['category_id'];
        ?>
" /><br/>
			<span class="small-text">
			<?php 
        printf(__('Enter the Category Slug from the %sEvent Categories%s page', 'event_espresso'), '<a href="' . admin_url('admin.php?page=espresso_events&action=category_list') . '" target="_blank">', '</a>');
        ?>
			</span>
		</p>

<?php 
    }
 /**
  *    generate_country_dropdown
  * @param      $QST
  * @param bool $get_all
  * @internal param array $question
  * @return array
  */
 public static function generate_country_dropdown($QST, $get_all = FALSE)
 {
     $countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
     if ($countries && count($countries) != count($QST->options())) {
         $QST->set('QST_type', 'DROPDOWN');
         // now add countries
         foreach ($countries as $country) {
             if ($country instanceof EE_Country) {
                 $QSO = EE_Question_Option::new_instance(array('QSO_value' => $country->ID(), 'QSO_desc' => $country->name(), 'QST_ID' => $QST->get('QST_ID'), 'QSO_deleted' => FALSE));
                 $QST->add_temp_option($QSO);
             }
         }
     }
     return $QST;
 }
 /**
  *        generate_question_form_inputs_for_object
  *
  * @access    protected
  * @param bool|object $object $object
  * @param    array    $input_types
  * @return        array
  */
 static function generate_question_form_inputs_for_object($object = FALSE, $input_types = array())
 {
     if (!is_object($object)) {
         return FALSE;
     }
     $inputs = array();
     $fields = $object->get_model()->field_settings(FALSE);
     //		$pk = $object->ID(); <<< NO!
     //		printr( $object, get_class( $object ) . '<br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     //		printr( $fields, '$fields  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     //		printr( $input_types, '$input_types  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     foreach ($fields as $field_ID => $field) {
         if ($field instanceof EE_Model_Field_Base) {
             //			echo '<h4>$field_ID : ' . $field_ID . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
             //			printr( $field, '$field  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
             if (isset($input_types[$field_ID])) {
                 // get saved value for field
                 $value = $object->get($field_ID);
                 //				echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                 // if no saved value, then use default
                 $value = $value !== NULL ? $value : $field->get_default_value();
                 //			if ( $field_ID == 'CNT_active' )
                 //				echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                 // determine question type
                 $type = isset($input_types[$field_ID]) ? $input_types[$field_ID]['type'] : 'TEXT';
                 // input name
                 $input_name = isset($input_types[$field_ID]) && isset($input_types[$field_ID]['input_name']) ? $input_types[$field_ID]['input_name'] . '[' . $field_ID . ']' : $field_ID;
                 // css class for input
                 $class = isset($input_types[$field_ID]['class']) && !empty($input_types[$field_ID]['class']) ? ' ' . $input_types[$field_ID]['class'] : '';
                 // whether to apply htmlentities to answer
                 $htmlentities = isset($input_types[$field_ID]['htmlentities']) ? $input_types[$field_ID]['htmlentities'] : TRUE;
                 // whether to apply htmlentities to answer
                 $label_b4 = isset($input_types[$field_ID]['label_b4']) ? $input_types[$field_ID]['label_b4'] : FALSE;
                 // whether to apply htmlentities to answer
                 $use_desc_4_label = isset($input_types[$field_ID]['use_desc_4_label']) ? $input_types[$field_ID]['use_desc_4_label'] : FALSE;
                 // create EE_Question_Form_Input object
                 $QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_ID' => 0, 'QST_display_text' => $field->get_nicename(), 'QST_type' => $type)), EE_Answer::new_instance(array('ANS_ID' => 0, 'QST_ID' => 0, 'REG_ID' => 0, 'ANS_value' => $value)), array('input_id' => $field_ID . '-' . $object->ID(), 'input_name' => $input_name, 'input_class' => $field_ID . $class, 'input_prefix' => '', 'append_qstn_id' => FALSE, 'htmlentities' => $htmlentities, 'label_b4' => $label_b4, 'use_desc_4_label' => $use_desc_4_label));
                 // does question type have options ?
                 if (in_array($type, array('DROPDOWN', 'SINGLE', 'MULTIPLE')) && isset($input_types[$field_ID]) && isset($input_types[$field_ID]['options'])) {
                     foreach ($input_types[$field_ID]['options'] as $option) {
                         $option = stripslashes_deep($option);
                         $option_id = !empty($option['id']) ? $option['id'] : 0;
                         $QSO = EE_Question_Option::new_instance(array('QSO_value' => (string) $option_id, 'QSO_desc' => $option['text'], 'QSO_deleted' => FALSE));
                         // all QST (and ANS) properties can be accessed indirectly thru QFI
                         $QFI->add_temp_option($QSO);
                     }
                 }
                 // we don't want ppl manually changing primary keys cuz that would just lead to total craziness man
                 if ($field_ID == $object->get_model()->primary_key_name()) {
                     $QFI->set('QST_disabled', TRUE);
                 }
                 //printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
                 $inputs[$field_ID] = $QFI;
                 //			if ( $field_ID == 'CNT_active' ) {
                 //				printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
                 //			}
             }
         }
     }
     return $inputs;
 }
 /**
  * @param bool|true $new_question
  * @throws \EE_Error
  */
 protected function _insert_or_update_question($new_question = TRUE)
 {
     do_action('AHEE_log', __FILE__, __FUNCTION__, '');
     $set_column_values = $this->_set_column_values_for($this->_question_model);
     if ($new_question) {
         $ID = $this->_question_model->insert($set_column_values);
         $success = $ID ? true : false;
         $action_desc = 'added';
     } else {
         $ID = absint($this->_req_data['QST_ID']);
         $pk = $this->_question_model->primary_key_name();
         $wheres = array($pk => $ID);
         unset($set_column_values[$pk]);
         $success = $this->_question_model->update($set_column_values, array($wheres));
         $action_desc = 'updated';
     }
     if ($ID) {
         //save the related options
         //trash removed options, save old ones
         //get list of all options
         /** @type EE_Question $question */
         $question = $this->_question_model->get_one_by_ID($ID);
         $options = $question->options();
         if (!empty($options)) {
             foreach ($options as $option_ID => $option) {
                 $option_req_index = $this->_get_option_req_data_index($option_ID);
                 if ($option_req_index !== FALSE) {
                     $option->save($this->_req_data['question_options'][$option_req_index]);
                 } else {
                     //not found, remove it
                     $option->delete();
                 }
             }
         }
         //save new related options
         foreach ($this->_req_data['question_options'] as $index => $option_req_data) {
             if (empty($option_req_data['QSO_ID']) && (isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '' || !empty($option_req_data['QSO_desc']))) {
                 //no ID! save it!
                 if (!isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') {
                     $option_req_data['QSO_value'] = $option_req_data['QSO_desc'];
                 }
                 $new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
                 $new_option->save();
             }
         }
     }
     $query_args = array('action' => 'edit_question', 'QST_ID' => $ID);
     if ($success !== FALSE) {
         $msg = $new_question ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name());
         EE_Error::add_success($msg);
     }
     $this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE);
 }
 /**
  * 		generate s HTML for the billing info form during registration
  * 		@access 		protected
  * 		@param		array	$billing_inputs - array of input field details
  * 		@param		array	$section - what part of the billing info form, "address", "credit_card", or "other"
  * 		@return 		string
  */
 protected function _generate_billing_info_form_fields($billing_inputs = array(), $section = FALSE)
 {
     do_action('AHEE_log', __FILE__, __FUNCTION__, '');
     if (empty($billing_inputs) || !$section) {
         return;
     }
     global $wp_filter, $css_class;
     // fill out section name
     $section = '_billing_info_' . $section . '_fields';
     // if you don't behave - this is what you're gonna get !!!
     $output = '';
     // cycle thru billing inputs
     foreach ($billing_inputs as $input_key => $billing_input) {
         // is the billing input in the requested section	?
         if (in_array($input_key, $this->{$section})) {
             // required fields get a *
             $required = $billing_input['required'] ? EEH_Form_Fields::prep_required(array('class' => 'required', 'label' => '<em>*</em>')) : '';
             // answer
             $answer = EE_Registry::instance()->REQ->is_set($input_key) ? EE_Registry::instance()->REQ->get($input_key) : $billing_input['value'];
             if ($input_key == '_reg-page-billing-card-exp-date-mnth-' . $this->_gateway_name) {
                 // Credit Card MONTH
                 add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_month_input_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= EEH_Form_Fields::select(__('Expiry Date', 'event_espresso'), $answer, EEH_Form_Fields::two_digit_months_dropdown_options(), $input_key, $input_key, $css_class . ' ee-credit-card-month display-inline small-txt', $required, '', '', '', FALSE, TRUE, FALSE);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_month_input_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= "\n\t\t\t" . '&nbsp;/&nbsp;';
             } elseif ($input_key == '_reg-page-billing-card-exp-date-year-' . $this->_gateway_name) {
                 // Credit Card YEAR
                 // remove label
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EEH_Form_Fields', 'remove_label_keep_required_msg'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_year_input_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= EEH_Form_Fields::select(__('Year', 'event_espresso'), $answer, EEH_Form_Fields::next_decade_two_digit_year_dropdown_options(), $input_key, $input_key, $css_class . ' ee-credit-card-year display-inline small-txt', $required, '', '', '', FALSE, TRUE, FALSE);
                 // remove filter that removes label, or else no other inputs will have labels
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EEH_Form_Fields', 'remove_label_keep_required_msg'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_year_input_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= "\n\t\t\t" . '<span class="small-text lt-grey-text">' . __('(mm/yy)', 'event_espresso') . '</span>';
             } else {
                 // create question form input
                 $QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => $billing_input['label'], 'QST_system' => $billing_input['db-col'], 'QST_type' => $billing_input['input'], 'QST_required' => $billing_input['required'])), EE_Answer::new_instance(array('ANS_value' => $answer)), array('input_name' => $input_key, 'input_id' => $input_key, 'input_class' => $css_class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
                 // add options
                 if (isset($billing_input['options'])) {
                     $options = is_array($billing_input['options']) ? $billing_input['options'] : explode(',', $billing_input['options']);
                     foreach ($options as $option) {
                         $QSO = EE_Question_Option::new_instance(array('QSO_value' => $option, 'QSO_desc' => $option));
                         $QFI->add_temp_option($QSO);
                     }
                 }
                 $output .= EEH_Form_Fields::generate_form_input($QFI);
             }
         }
         // end if ( in_array( $input_key, $this->$section ))
     }
     // end foreach( $billing_inputs as $input_key => $billing_input )
     return $output;
 }
 /**
  * _settings_page
  * @param $template
  */
 protected function _settings_page($template)
 {
     EE_Registry::instance()->load_helper('Form_Fields');
     $this->_template_args['new_addon_config'] = EE_Config::instance()->get_config('addons', 'EED_New_Addon', 'EE_New_Addon_Config');
     add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
     $this->_template_args['yes_no_values'] = array(EE_Question_Option::new_instance(array('QSO_value' => 0, 'QSO_desc' => __('No', 'event_espresso'))), EE_Question_Option::new_instance(array('QSO_value' => 1, 'QSO_desc' => __('Yes', 'event_espresso'))));
     $this->_template_args['return_action'] = $this->_req_action;
     $this->_template_args['reset_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'reset_settings', 'return_action' => $this->_req_action), EE_NEW_ADDON_ADMIN_URL);
     $this->_set_add_edit_form_tags('update_settings');
     $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
     $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_NEW_ADDON_ADMIN_TEMPLATE_PATH . $template, $this->_template_args, TRUE);
     $this->display_admin_page_with_sidebar();
 }