Automattic\WooCommerce\Internal\Admin\Settings

SettingsUISchema::get_optionsprivate staticWC 1.0

Normalize field options.

Method of the class: SettingsUISchema{}

No Hooks.

Returns

Array.

Usage

$result = SettingsUISchema::get_options( $setting ): array;
$setting(array) (required)
Legacy field definition.

SettingsUISchema::get_options() code WC 10.9.1

private static function get_options( array $setting ): array {
	if ( ! isset( $setting['options'] ) || ! is_array( $setting['options'] ) ) {
		return array();
	}

	$options = array();
	foreach ( $setting['options'] as $value => $label ) {
		if ( ! is_scalar( $label ) && null !== $label ) {
			continue;
		}

		$options[] = array(
			'label' => is_scalar( $label ) ? wp_strip_all_tags( html_entity_decode( (string) $label, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ) : '',
			'value' => (string) $value,
		);
	}

	return $options;
}