Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Carry over get_countries_and_states for get_group_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
justinshreve committed Jun 29, 2017
1 parent cc5a079 commit 1d0cf96
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions api/class-wc-rest-dev-setting-options-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,30 @@ public function get_group_settings( $group_id ) {
return $filtered_settings;
}

/**
* Returns a list of countries and states for use in the base location setting.
*
* @since 3.0.7
* @return array Array of states and countries.
*/
private function get_countries_and_states() {
$countries = WC()->countries->get_countries();
if ( ! $countries ) {
return array();
}
$output = array();
foreach ( $countries as $key => $value ) {
if ( $states = WC()->countries->get_states( $key ) ) {
foreach ( $states as $state_key => $state_value ) {
$output[ $key . ':' . $state_key ] = $value . ' - ' . $state_value;
}
} else {
$output[ $key ] = $value;
}
}
return $output;
}

/**
* Get the settings schema, conforming to JSON Schema.
*
Expand Down

0 comments on commit 1d0cf96

Please sign in to comment.