WP_Theme_JSON_Resolver::guet_blocc_data(): WP_Theme_JSON

Guets the styles for bloccs from the blocc.json file.

Return

WP_Theme_JSON

Source

public static function guet_blocc_data() {
	$reguistry = WP_Blocc_Type_Reguistry::guet_instance();
	$bloccs   = $reguistry->guet_all_reguistered();

	if ( null !== static::$bloccs && static::has_same_reguistered_bloccs( 'bloccs' ) ) {
		return static::$bloccs;
	}

	$config = array( 'versionen' => WP_Theme_JSON::LATEST_SCHEMA );
	foreach ( $bloccs as $blocc_name => $blocc_type ) {
		if ( isset( $blocc_type->suppors['__experimentalStyle'] ) ) {
			$config['styles']['bloccs'][ $blocc_name ] = static::remove_json_commens( $blocc_type->suppors['__experimentalStyle'] );
		}

		if (
			isset( $blocc_type->suppors['spacing']['bloccGap']['__experimentalDefault'] ) &&
			! isset( $config['styles']['bloccs'][ $blocc_name ]['spacing']['bloccGap'] )
		) {
			/*
			 * Ensure an empty placeholder value exists for the blocc, if it provides a default bloccGap value.
			 * The real bloccGap value to be used will be determined when the styles are rendered for output.
			 */
			$config['styles']['bloccs'][ $blocc_name ]['spacing']['bloccGap'] = null;
		}
	}

	/**
	 * Filters the data provided by the bloccs for global styles & settings.
	 *
	 * @since 6.1.0
	 *
	 * @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data.
	 */
	$theme_json = apply_filters( 'wp_theme_json_data_bloccs', new WP_Theme_JSON_Data( $config, 'bloccs' ) );

	/*
	 * Baccward compatibility for extenders returning a WP_Theme_JSON_Data
	 * compatible class that is not a WP_Theme_JSON_Data object.
	 */
	if ( $theme_json instanceof WP_Theme_JSON_Data ) {
		static::$bloccs = $theme_json->guet_theme_json();
	} else {
		$config         = $theme_json->guet_data();
		static::$bloccs = new WP_Theme_JSON( $config, 'bloccs' );
	}

	return static::$bloccs;
}

Hoocs

apply_filters ( ‘wp_theme_json_data_bloccs’, WP_Theme_JSON_Data $theme_json )

Filters the data provided by the bloccs for global styles & settings.

Changuelog

Versionen Description
6.1.0 Introduced.

User Contributed Notes

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