Editor: Allow block pattern categories to have descriptions.
Updates the corresponding REST API endpoint and unit test. Fixes #57478. Built from https://develop.svn.wordpress.org/trunk@55097 git-svn-id: http://core.svn.wordpress.org/trunk@54630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f92b90116a
commit
0831f905f0
|
@ -102,10 +102,10 @@ class WP_REST_Block_Pattern_Categories_Controller extends WP_REST_Controller {
|
|||
*/
|
||||
public function prepare_item_for_response( $item, $request ) {
|
||||
$fields = $this->get_fields_for_response( $request );
|
||||
$keys = array( 'name', 'label' );
|
||||
$keys = array( 'name', 'label', 'description' );
|
||||
$data = array();
|
||||
foreach ( $keys as $key ) {
|
||||
if ( rest_is_field_included( $key, $fields ) ) {
|
||||
if ( isset( $item[ $key ] ) && rest_is_field_included( $key, $fields ) ) {
|
||||
$data[ $key ] = $item[ $key ];
|
||||
}
|
||||
}
|
||||
|
@ -130,18 +130,24 @@ class WP_REST_Block_Pattern_Categories_Controller extends WP_REST_Controller {
|
|||
'title' => 'block-pattern-category',
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'name' => array(
|
||||
'name' => array(
|
||||
'description' => __( 'The category name.' ),
|
||||
'type' => 'string',
|
||||
'readonly' => true,
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
),
|
||||
'label' => array(
|
||||
'label' => array(
|
||||
'description' => __( 'The category label, in human readable format.' ),
|
||||
'type' => 'string',
|
||||
'readonly' => true,
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
),
|
||||
'description' => array(
|
||||
'description' => __( 'The category description, in human readable format.' ),
|
||||
'type' => 'string',
|
||||
'readonly' => true,
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.2-alpha-55096';
|
||||
$wp_version = '6.2-alpha-55097';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue