LLMS_REST_Posts_Controller::prepare_object_for_response( LLMS_Post_Model $object, WP_REST_Request $request )
Prepare a single object output for response.
Parameters Parameters
- $object
-
(LLMS_Post_Model) (Required) object object.
- $request
-
(WP_REST_Request) (Required) Full details about the request.
Return Return
(array)
Source Source
File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-posts-controller.php
add_filter( 'post_password_required', '__return_false' ); } $items = parent::prepare_collection_items_for_response( $objects, $request ); // Reset filter. if ( 'edit' === $request['context'] ) { remove_filter( 'post_password_required', '__return_false' ); } return $items; } /** * Prepare a single object output for response. * * @since 1.0.0-beta.1 * * @param LLMS_Post_Model $object object object. * @param WP_REST_Request $request Full details about the request. * @return array */ protected function prepare_object_for_response( $object, $request ) { $object_id = $object->get( 'id' ); $password_required = post_password_required( $object_id ); $password = $object->get( 'password' ); $data = array( 'id' => $object->get( 'id' ), 'date_created' => $object->get_date( 'date', 'Y-m-d H:i:s' ), 'date_created_gmt' => $object->get_date( 'date_gmt', 'Y-m-d H:i:s' ), 'date_updated' => $object->get_date( 'modified', 'Y-m-d H:i:s' ), 'date_updated_gmt' => $object->get_date( 'modified_gmt', 'Y-m-d H:i:s' ), 'menu_order' => $object->get( 'menu_order' ), 'title' => array( 'raw' => $object->get( 'title', true ), 'rendered' => $object->get( 'title' ), ),
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.1 | Introduced. |