- Timestamp:
- 10/10/2023 02:03:03 PM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
r56753 r56819 761 761 $links = array( 762 762 'self' => array( 763 'href' => rest_url( rest_get_route_for_post($id ) ),763 'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $this->rest_base, $id ) ), 764 764 ), 765 765 'collection' => array( … … 770 770 ), 771 771 ); 772 773 if ( post_type_supports( $this->post_type, 'revisions' ) ) { 774 $template = get_block_template( $id, $this->post_type ); 775 if ( $template instanceof WP_Block_Template && ! empty( $template->wp_id ) ) { 776 $revisions = wp_get_latest_revision_id_and_total_count( $template->wp_id ); 777 $revisions_count = ! is_wp_error( $revisions ) ? $revisions['count'] : 0; 778 $revisions_base = sprintf( '/%s/%s/%s/revisions', $this->namespace, $this->rest_base, $id ); 779 780 $links['version-history'] = array( 781 'href' => rest_url( $revisions_base ), 782 'count' => $revisions_count, 783 ); 784 785 if ( $revisions_count > 0 ) { 786 $links['predecessor-version'] = array( 787 'href' => rest_url( $revisions_base . '/' . $revisions['latest_id'] ), 788 'id' => $revisions['latest_id'], 789 ); 790 } 791 } 792 } 772 793 773 794 return $links;
Note: See TracChangeset
for help on using the changeset viewer.