WP_REST_Themes_Controller::prepare_theme_support
Prepares the theme support value for inclusion in the REST API response.
Метод класса: WP_REST_Themes_Controller{}
Хуков нет.
Возвращает
mixed. The prepared support value.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prepare_theme_support( $support, $args, $feature, $request );
- $support(разное) (обязательный)
- The raw value from get_theme_support().
- $args(массив) (обязательный)
- The feature's registration args.
- $feature(строка) (обязательный)
- The feature name.
- $request(WP_REST_Request) (обязательный)
- The request object.
Список изменений
| С версии 5.5.0 | Введена. |
Код WP_REST_Themes_Controller::prepare_theme_support() WP REST Themes Controller::prepare theme support WP 7.1.2
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 );
}