From 2a7d1e2394400f468203d4eefa9d60d0525c7f59 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Tue, 10 Nov 2020 20:24:38 +0000 Subject: [PATCH] Editor: Display short description from block directory in results. Props dd32, ryelle. Fixes #51212. git-svn-id: https://develop.svn.wordpress.org/trunk@49559 602fd350-edb4-49c9-b593-d223f7449a82 --- .../endpoints/class-wp-rest-block-directory-controller.php | 2 +- .../phpunit/tests/rest-api/rest-block-directory-controller.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php index e76940f7b7..c3cf4938a2 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php @@ -125,7 +125,7 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller { $block = array( 'name' => $block_data['name'], 'title' => ( $block_data['title'] ? $block_data['title'] : $plugin['name'] ), - 'description' => wp_trim_words( $plugin['description'], 30, '...' ), + 'description' => wp_trim_words( $plugin['short_description'], 30, '...' ), 'id' => $plugin['slug'], 'rating' => $plugin['rating'] / 20, 'rating_count' => (int) $plugin['num_ratings'], diff --git a/tests/phpunit/tests/rest-api/rest-block-directory-controller.php b/tests/phpunit/tests/rest-api/rest-block-directory-controller.php index 3060efb0c1..940040e723 100644 --- a/tests/phpunit/tests/rest-api/rest-block-directory-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-directory-controller.php @@ -153,7 +153,7 @@ class WP_REST_Block_Directory_Controller_Test extends WP_Test_REST_Controller_Te $expected = array( 'name' => 'sortabrilliant/guidepost', 'title' => 'Guidepost', - 'description' => 'A guidepost gives you directions. It lets you know where you’re going. It gives you a preview of what’s to come. How does it work? Guideposts are magic, no they...', + 'description' => 'A guidepost gives you directions. It lets you know where you’re going. It gives you a preview of what’s to come.', 'id' => 'guidepost', 'rating' => 4.3, 'rating_count' => 90,