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
This commit is contained in:
Helen Hou-Sandi 2020-11-10 20:24:38 +00:00
parent bde89301fd
commit 2a7d1e2394
2 changed files with 2 additions and 2 deletions

View File

@ -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'],

View File

@ -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 youre going. It gives you a preview of whats to come. How does it work? Guideposts are magic, no they...',
'description' => 'A guidepost gives you directions. It lets you know where youre going. It gives you a preview of whats to come.',
'id' => 'guidepost',
'rating' => 4.3,
'rating_count' => 90,