wp_normalize_remote_block_pattern()WP 6.2.0

Normalize the pattern properties to camelCase.

The API's format is snake_case, register_block_pattern() camelCase.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

Array. Normalized pattern.

Usage

wp_normalize_remote_block_pattern( $pattern );
$pattern(array) (required)
Pattern as returned from the Pattern Directory API.

Changelog

Since 6.2.0 Introduced.

wp_normalize_remote_block_pattern() code WP 6.7.1

function wp_normalize_remote_block_pattern( $pattern ) {
	if ( isset( $pattern['block_types'] ) ) {
		$pattern['blockTypes'] = $pattern['block_types'];
		unset( $pattern['block_types'] );
	}

	if ( isset( $pattern['viewport_width'] ) ) {
		$pattern['viewportWidth'] = $pattern['viewport_width'];
		unset( $pattern['viewport_width'] );
	}

	return (array) $pattern;
}