Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

wp_normalize_remote_block_pattern( array $pattern ): array

Normalize the pattern properties to camelCase.


Description

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


Top ↑

Parameters

$pattern array Required
Pattern as returned from the Pattern Directory API.

Top ↑

Return

array Normalized pattern.


Top ↑

Source

File: wp-includes/block-patterns.php. View all references

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;
}


Top ↑

Changelog

Changelog
Version Description
6.2.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.