wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_normalize_remote_block_pattern › WordPress Function

Seit6.2.0
Veraltetn/v
wp_normalize_remote_block_pattern ( $pattern )
Zugriff:
  • private
Parameter:
  • (array) $pattern Pattern as returned from the Pattern Directory API.
    Erforderlich: Ja
Gibt zurück:
  • (array) Normalized pattern.
Definiert in:
Codex:

Normalize the pattern properties to camelCase.

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


Quellcode

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