WC_REST_General_Settings_V4_Controller::get_field_optionsprivateWC 1.0

Get options for specific field types.

Method of the class: WC_REST_General_Settings_V4_Controller{}

No Hooks.

Returns

Array. Field options.

Usage

// private - for code of main (parent) class only
$result = $this->get_field_options( $field_type, $field_id );
$field_type(string) (required)
Field type.
$field_id(string) (required)
Field ID.

WC_REST_General_Settings_V4_Controller::get_field_options() code WC 10.3.6

private function get_field_options( $field_type, $field_id ) {
	switch ( $field_type ) {
		case 'single_select_country':
			return $this->get_country_state_options();

		case 'multi_select_countries':
			return WC()->countries->get_countries();

		case 'select':
			// Handle specific select fields that need custom options.
			if ( 'woocommerce_currency' === $field_id ) {
				return $this->get_currency_options();
			}
			break;
	}

	return array();
}