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
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | 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. |