WPCF7_REST_Controller::get_schema
Метод класса: 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() WPCF7 REST Controller::get schema CF7 6.1.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 );
}