WordPress at a glance
function is not described

WP_REST_Themes_Controller::prepare_theme_support() protected WP 5.5.0

Prepares the theme support value for inclusion in the REST API response.

{} It's a method of the class: WP_REST_Themes_Controller{}

No Hooks.

Return

Mixed. The prepared support value.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_theme_support( $support, $args, $feature, $request );
$support(mixed) (required)
The raw value from get_theme_support().
$args(array) (required)
The feature's registration args.
$feature(string) (required)
The feature name.
$request(WP_REST_Request) (required)
The request object.

Changelog

Since 5.5.0 Introduced.

Code of WP_REST_Themes_Controller::prepare_theme_support() WP 5.5.3

<?php
protected function prepare_theme_support( $support, $args, $feature, $request ) {
	$schema = $args['show_in_rest']['schema'];

	if ( 'boolean' === $schema['type'] ) {
		return true;
	}

	if ( is_array( $support ) && ! $args['variadic'] ) {
		$support = $support[0];
	}

	return rest_sanitize_value_from_schema( $support, $schema );
}