WPCF7_REST_Controller::get_contact_form
Метод класса: 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() WPCF7 REST Controller::get contact form CF7 6.1.6
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 );
}