wp_normalize_remote_block_pattern()
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.
Returns
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() wp normalize remote block pattern code WP 7.0
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;
}