WPCF7_REST_Controller::get_schema()publicCF7 1.0

Метод класса: WPCF7_REST_Controller{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WPCF7_REST_Controller = new WPCF7_REST_Controller();
$WPCF7_REST_Controller->get_schema( $request );
$request(WP_REST_Request) (обязательный)
-

Код WPCF7_REST_Controller::get_schema() CF7 5.9.3

public function get_schema( WP_REST_Request $request ) {
	$url_params = $request->get_url_params();

	$item = null;

	if ( ! empty( $url_params['id'] ) ) {
		$item = wpcf7_contact_form( $url_params['id'] );
	}

	if ( ! $item ) {
		return new WP_Error( 'wpcf7_not_found',
			__( "The requested contact form was not found.", 'contact-form-7' ),
			array( 'status' => 404 )
		);
	}

	$schema = $item->get_schema();

	$response = isset( $schema ) ? $schema->to_array() : array();

	return rest_ensure_response( $response );
}