WPCF7_REST_Controller::get_contact_form()publicCF7 1.0

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

Хуков нет.

Возвращает

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

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

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

Код WPCF7_REST_Controller::get_contact_form() CF7 5.9.3

public function get_contact_form( WP_REST_Request $request ) {
	$id = (int) $request->get_param( 'id' );
	$item = wpcf7_contact_form( $id );

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

	$response = array(
		'id' => $item->id(),
		'slug' => $item->name(),
		'title' => $item->title(),
		'locale' => $item->locale(),
		'properties' => $this->get_properties( $item ),
	);

	return rest_ensure_response( $response );
}