WP_Theme_JSON::__construct( array $theme_json = array(), string $origin = ‘theme’ )

In this article

Constructor.

Parameters

$theme_jsonarrayoptional
A structure that follows the theme.json schema.

Default:array()

$originstringoptional
What source of data this object represents.
One of 'default', 'theme', or 'custom'. Default 'theme'.

Default:'theme'

Source

 *   array(
 *    'fontFamily' => null,
 *    'slug' => null,
 *   )
 * )
 *
 * Returns:
 * array(
 *  'fontFamily' => null,
 *  'slug' => null,
 *  'default' => array(
 *    'fontFamily' => null,
 *    'slug' => null,
 *  ),
 *  'blocks' => array(
 *    'fontFamily' => null,
 *    'slug' => null,
 *  ),
 *  'theme' => array(
 *     'fontFamily' => null,
 *     'slug' => null,
 *  ),
 *  'custom' => array(
 *     'fontFamily' => null,
 *     'slug' => null,
 *  ),
 * )
 */
protected static function schema_in_root_and_per_origin( $schema ) {
	$schema_in_root_and_per_origin = $schema;
	foreach ( static::VALID_ORIGINS as $origin ) {
		$schema_in_root_and_per_origin[ $origin ] = $schema;
	}
	return $schema_in_root_and_per_origin;
}

Changelog

VersionDescription
5.8.0Introduced.

User Contributed Notes

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