WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Schemas

AbstractSchema::get_recursive_schema_property_defaults() protected WC 1.0

Gets an array of schema defaults recursively.

{} It's a method of the class: AbstractSchema{}

No Hooks.

Return

Array. Array of defaults, pulled from arg_options

Usage

// protected - for code of main (parent) or child class
$result = $this->get_recursive_schema_property_defaults( $properties );
$properties(array) (required)
Schema property data.

Code of AbstractSchema::get_recursive_schema_property_defaults() WC 5.8.0

protected function get_recursive_schema_property_defaults( $properties ) {
	$defaults = [];

	foreach ( $properties as $property_key => $property_value ) {
		if ( isset( $property_value['arg_options']['default'] ) ) {
			$defaults[ $property_key ] = $property_value['arg_options']['default'];
		} elseif ( isset( $property_value['properties'] ) ) {
			$defaults[ $property_key ] = $this->get_recursive_schema_property_defaults( $property_value['properties'] );
		}
	}

	return $defaults;
}