REST API: Remove assets field from block directory controller.

Gutenberg no longer uses the assets field to fetch the assets for the installed block so this field can be dropped from the endpoint. This allows us to reintroduce it at a later point without needing to worry about backward compatibility.

See #50732.

Built from https://develop.svn.wordpress.org/trunk@48656


git-svn-id: http://core.svn.wordpress.org/trunk@48418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
TimothyBlynJacobs 2020-07-28 04:10:10 +00:00
parent 26b706e27f
commit c461697c31
2 changed files with 1 additions and 27 deletions

View File

@ -129,7 +129,6 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller {
'author_block_count' => intval( $plugin['author_block_count'] ),
'author' => wp_strip_all_tags( $plugin['author'] ),
'icon' => ( isset( $plugin['icons']['1x'] ) ? $plugin['icons']['1x'] : 'block-default' ),
'assets' => array(),
'last_updated' => gmdate( 'Y-m-d\TH:i:s', strtotime( $plugin['last_updated'] ) ),
'humanized_updated' => sprintf(
/* translators: %s: Human-readable time difference. */
@ -138,21 +137,6 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller {
),
);
foreach ( $plugin['block_assets'] as $asset ) {
// Allow for fully qualified URLs in future
if ( 'https' === wp_parse_url( $asset, PHP_URL_SCHEME ) && ! empty( wp_parse_url( $asset, PHP_URL_HOST ) ) ) {
$block['assets'][] = esc_url_raw(
$asset,
array( 'https' )
);
} else {
$block['assets'][] = esc_url_raw(
add_query_arg( 'v', strtotime( $block['last_updated'] ), 'https://ps.w.org/' . $plugin['slug'] . $asset ),
array( 'https' )
);
}
}
$this->add_additional_fields_to_object( $block, $request );
$response = new WP_REST_Response( $block );
@ -296,16 +280,6 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller {
'type' => 'string',
'context' => array( 'view' ),
),
'assets' => array(
'description' => __( 'An object representing the block CSS and JavaScript assets.' ),
'type' => 'array',
'context' => array( 'view' ),
'readonly' => true,
'items' => array(
'type' => 'string',
'format' => 'uri',
),
),
),
);

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-beta4-48655';
$wp_version = '5.5-beta4-48656';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.