Automattic\WooCommerce\Internal\Admin\Settings

SettingsUISchema::get_custom_attributesprivate staticWC 1.0

Normalize custom attributes for React controls.

Method of the class: SettingsUISchema{}

No Hooks.

Returns

Array.

Usage

$result = SettingsUISchema::get_custom_attributes( $custom_attributes ): array;
$custom_attributes(array) (required)
Raw custom attributes.

SettingsUISchema::get_custom_attributes() code WC 10.9.1

private static function get_custom_attributes( array $custom_attributes ): array {
	$attributes = array();

	foreach ( $custom_attributes as $attribute => $value ) {
		if ( ! is_scalar( $value ) ) {
			continue;
		}

		$attribute_key = sanitize_key( (string) $attribute );
		if ( '' === $attribute_key ) {
			continue;
		}

		$attributes[ $attribute_key ] = $value;
	}

	return $attributes;
}