Prepares a single model output for response.
Description
See also
Parameters
- $model
-
(awsmug\Torro_Forms\DB_Objects\Element_Choices\Model) (Required) Model object.
- $request
-
(awsmug\Torro_Forms\DB_Objects\Element_Choices\WP_REST_Request) (Required) Request object.
Return
(awsmug\Torro_Forms\DB_Objects\Element_Choices\WP_REST_Response) Response object.
Source
File: src/db-objects/element-choices/rest-element-choices-controller.php
public function prepare_item_for_response( $model, $request ) { $response = parent::prepare_item_for_response( $model, $request ); if ( isset( $response->data['field'] ) && '' === $response->data['field'] ) { $response->data['field'] = '_main'; } return $response; }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |