WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/19/2018 05:57:38 PM (22 months ago)
Author:
danielbachhuber
Message:

REST API: Include block_version on Post content object.

The block_version denotes which version of Blocks the post_content contains. Introduces new block_version() function for versioning Blocks.

Props danielbachhuber, birgire.
Fixes #43887.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r43737 r43770  
    15101510        if ( in_array( 'content', $fields, true ) ) {
    15111511            $data['content'] = array(
    1512                 'raw'       => $post->post_content,
     1512                'raw'           => $post->post_content,
    15131513                /** This filter is documented in wp-includes/post-template.php */
    1514                 'rendered'  => post_password_required( $post ) ? '' : apply_filters( 'the_content', $post->post_content ),
    1515                 'protected' => (bool) $post->post_password,
     1514                'rendered'      => post_password_required( $post ) ? '' : apply_filters( 'the_content', $post->post_content ),
     1515                'protected'     => (bool) $post->post_password,
     1516                'block_version' => block_version( $post->post_content ),
    15161517            );
    15171518        }
     
    20632064                                'readonly'    => true,
    20642065                            ),
     2066                            'block_version' => array(
     2067                                'description' => __( 'Version of the content block format used by the object.' ),
     2068                                'type'        => 'integer',
     2069                                'context'     => array( 'edit' ),
     2070                                'readonly'    => true,
     2071                            ),
    20652072                            'protected'       => array(
    20662073                                'description' => __( 'Whether the content is protected with a password.' ),
Note: See TracChangeset for help on using the changeset viewer.