public function venue_address_metabox()
 {
     $template_args['_venue'] = $this->_cpt_model_obj;
     $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input($QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), array('input_name' => 'sta_id', 'input_id' => 'sta_id', 'input_class' => '', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input($QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), array('input_name' => 'cnt_iso', 'input_id' => 'cnt_iso', 'input_class' => '', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
     EEH_Template::display_template($template, $template_args);
 }
 /**
  * Metabox for person details
  * @param  WP_Post $post wp post object
  * @return string        person address details (and form)
  */
 public function person_address_details($post)
 {
     //get people object (should already have it)
     $this->_template_args['person'] = $this->_cpt_model_obj;
     $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(new EE_Question_Form_Input(EE_Question::new_instance(array('QST_ID' => 0, 'QST_display_text' => __('State/Province', 'event_espresso'), 'QST_system' => 'admin-state')), EE_Answer::new_instance(array('ANS_ID' => 0, 'ANS_value' => $this->_cpt_model_obj->state_ID())), array('input_id' => 'STA_ID', 'input_name' => 'STA_ID', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(new EE_Question_Form_Input(EE_Question::new_instance(array('QST_ID' => 0, 'QST_display_text' => __('Country', 'event_espresso'), 'QST_system' => 'admin-country')), EE_Answer::new_instance(array('ANS_ID' => 0, 'ANS_value' => $this->_cpt_model_obj->country_ID())), array('input_id' => 'CNT_ISO', 'input_name' => 'CNT_ISO', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template = EEA_PEOPLE_ADDON_ADMIN_TEMPLATE_PATH . 'people_address_details_metabox_content.template.php';
     EEH_Template::display_template($template, $this->_template_args);
 }
<div class="padding">

	<h2 class="ee-admin-settings-hdr"><?php 
_e('Countries and States/Provinces', 'event_espresso');
?>
 <?php 
echo EEH_Template::get_help_tab_link('country_select_info');
?>
</h2>
	<table class="form-table">
		<tbody>
			<?php 
echo EEH_Form_Fields::generate_form_input($countries);
?>
		</tbody>
	</table>
	<br/>
	<p>
        <?php 
_e('The country that is selected above will populate the Country Details settings and the options for States/Provinces. This information will be used throughout Event Espresso including for registration purposes and how currency is displayed. If you make a change to the country on this page, it is important that you also update your Contact Information on the Your Organization tab.', 'event_espresso');
?>
	</p>
	<div id="country-details-settings-dv">
		<h2 class="ee-admin-settings-hdr"><?php 
_e('Country Details', 'event_espresso');
?>
 <?php 
echo EEH_Template::get_help_tab_link('country_details_info');
?>
</h2>
 /**
  * 	display_add_new_state_micro_form
  *
  * 	@access 	public
  * 	@return 		string
  */
 public static function display_add_new_state_micro_form($input_html, $question, $answer, $name, $id, $class, $system_ID)
 {
     // load JS
     add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10);
     $output = '';
     // we're only doing this for state select inputs
     if ($system_ID == 'state') {
         // add hidden input to indicate that a new state is being added
         $output .= EEH_Form_Fields::hidden_input(str_replace('state', 'add_new_state', $name), 0, str_replace('state', 'add_new_state', $id));
         $output .= '<a id="display-' . $id . '" class="ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js" rel="' . $id . '">' . __('click here to add a new state/province', 'event_espresso') . '</a>';
         $output .= '<div id="' . $id . '-dv" class="ee-form-add-new-state-dv" style="display: none;">';
         $output .= '<h6>' . __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso') . '</h6>';
         $output .= '<ul>';
         $output .= sprintf(__('%1$sfirst select the Country that your State/Province belongs to%2$s%1$senter the name of your State/Province%2$s%1$senter a two to six letter abbreviation for the name of your State/Province%2$s%1$sclick the ADD button%2$s', 'event_espresso'), '<li>', '</li>');
         $output .= '</ul>';
         // NEW STATE COUNTRY
         $cntry_id = str_replace('state', 'new_state_country', $id);
         $cntry_input = str_replace('state', 'new_state_country', $name);
         $country = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => __('New State/Province Country', 'event_espresso'), 'QST_system' => 'admin-country', 'QST_type' => EEM_Question::QST_type_dropdown, 'QST_required' => FALSE)), EE_Answer::new_instance(array('ANS_value' => EE_Registry::instance()->REQ->is_set($cntry_input) ? EE_Registry::instance()->REQ->get($cntry_input) : '')), array('input_name' => $cntry_input, 'input_id' => $cntry_id, 'input_class' => $class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
         $output .= EEH_Form_Fields::generate_form_input($country);
         // NEW STATE NAME
         $state_id = str_replace('state', 'new_state_name', $id);
         $state_name = str_replace('state', 'new_state_name', $name);
         $new_state_name = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => __('New State/Province Name', 'event_espresso'), 'QST_system' => '', 'QST_type' => EEM_Question::QST_type_text, 'QST_required' => FALSE)), EE_Answer::new_instance(array('ANS_value' => EE_Registry::instance()->REQ->is_set($state_name) ? EE_Registry::instance()->REQ->get($state_name) : '')), array('input_name' => $state_name, 'input_id' => $state_id, 'input_class' => $class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
         $output .= EEH_Form_Fields::generate_form_input($new_state_name);
         // NEW STATE ABBREVIATION
         $abbrv_id = str_replace('state', 'new_state_abbrv', $id);
         $abbrv_name = str_replace('state', 'new_state_abbrv', $name);
         $new_state_abbrv = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => __('New State/Province Abbreviation', 'event_espresso'), 'QST_system' => '', 'QST_type' => EEM_Question::QST_type_text, 'QST_required' => FALSE)), EE_Answer::new_instance(array('ANS_value' => EE_Registry::instance()->REQ->is_set($abbrv_name) ? EE_Registry::instance()->REQ->get($abbrv_name) : '')), array('input_name' => $abbrv_name, 'input_id' => $abbrv_id, 'input_class' => $class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
         // add filters for reducing size of State Abbrv text input, and adding an "ADD" button, as well as a "cancel" button
         add_filter('FHEE__EEH_Form_Fields__additional_form_field_attributes', array('EED_Add_New_State', 'set_new_state_input_size'));
         add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Add_New_State', 'add_new_state_submit_button'), 1, 3);
         add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Add_New_State', 'cancel_new_state'), 2, 3);
         $output .= EEH_Form_Fields::generate_form_input($new_state_abbrv);
         // remove the filters from above so that they don't affect any other inputs
         remove_filter('FHEE__EEH_Form_Fields__additional_form_field_attributes', array('EED_Add_New_State', 'set_new_state_input_size'));
         remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Add_New_State', 'add_new_state_submit_button'), 1, 3);
         remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Add_New_State', 'cancel_new_state'), 2, 3);
         $output .= '</div>';
     }
     return $input_html . $output;
 }
			</tr>
		</thead>
		<tbody>
		<?php 
//printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
if ($states) {
    foreach ($states as $STA_ID => $state) {
        ?>
			<tr id="state-<?php 
        echo $STA_ID;
        ?>
-tr" class="country-state-columns">
			<?php 
        foreach ($state['inputs'] as $ID => $input) {
            if ($ID != 'STA_ID' && $ID != 'CNT_ISO') {
                echo EEH_Form_Fields::generate_form_input($input);
            }
        }
        ?>
				<td class="delete-state-td">
					<a id="delete-state-<?php 
        echo $STA_ID;
        ?>
-lnk" class="dashicons dashicons-post-trash ee-icon-size-20 delete-state-lnk" rel="<?php 
        echo $STA_ID;
        ?>
" title="Delete State #<?php 
        echo $STA_ID;
        ?>
?" href="<?php 
        echo $state['delete_state_url'];
 /**
  * 		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;
 }
 /**
  * decaf venue metabox
  * @return string form for Event Venue
  */
 public function venue_metabox()
 {
     //first let's see if we have a venue already
     $event_id = $this->_cpt_model_obj->ID();
     $venue = !empty($event_id) ? $this->_cpt_model_obj->venues() : NULL;
     $venue = empty($venue) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift($venue);
     $template_args['_venue'] = $venue;
     $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input($QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), EE_Answer::new_instance(array('ANS_value' => $venue->state_ID())), array('input_name' => 'state', 'input_id' => 'phys-state', 'input_class' => '', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input($QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), EE_Answer::new_instance(array('ANS_value' => $venue->country_ID())), array('input_name' => 'countries', 'input_id' => 'phys-country', 'input_class' => '', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template_path = EVENTS_TEMPLATE_PATH . 'event_venues_metabox_content.template.php';
     EEH_Template::display_template($template_path, $template_args);
 }