Skip to content

Commit

Permalink
Editor: Add excerpt support to the wp_block post type.
Browse files Browse the repository at this point in the history
The purpose is to enable using the excerpt as a description for user-created patterns on the Site Editor Pattern screens.

This commit backports the original PR from Gutenberg repository:
* [[WordPress/gutenberg#60549: [Data Views] User patterns: Use excerpt as description]]

Reference: [[WordPress/gutenberg#55244: Patterns: Add descriptions to user-created patterns]].

Follow-up to [44146], [44150], [50835], [56030].

Props poena, ntsekouras, krupalpanchal.
Fixes #61250.

git-svn-id: https://develop.svn.wordpress.org/trunk@58184 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed May 23, 2024
1 parent e085371 commit 5dc0cc0
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ function create_initial_post_types() {
'map_meta_cap' => true,
'supports' => array(
'title',
'excerpt',
'editor',
'revisions',
'custom-fields',
Expand Down
107 changes: 107 additions & 0 deletions tests/qunit/fixtures/wp-api-generated.js
Original file line number Diff line number Diff line change
Expand Up @@ -3879,6 +3879,40 @@ mockedApiResponse.Schema = {
},
"required": false
},
"excerpt": {
"description": "The excerpt for the post.",
"type": "object",
"properties": {
"raw": {
"description": "Excerpt for the post, as it exists in the database.",
"type": "string",
"context": [
"edit"
]
},
"rendered": {
"description": "HTML excerpt for the post, transformed for display.",
"type": "string",
"context": [
"view",
"edit",
"embed"
],
"readonly": true
},
"protected": {
"description": "Whether the excerpt is protected with a password.",
"type": "boolean",
"context": [
"view",
"edit",
"embed"
],
"readonly": true
}
},
"required": false
},
"meta": {
"description": "Meta fields.",
"type": "object",
Expand Down Expand Up @@ -3939,6 +3973,11 @@ mockedApiResponse.Schema = {
"default": "view",
"required": false
},
"excerpt_length": {
"description": "Override the default excerpt length.",
"type": "integer",
"required": false
},
"password": {
"description": "The password for the post if it is password protected.",
"type": "string",
Expand Down Expand Up @@ -4049,6 +4088,40 @@ mockedApiResponse.Schema = {
},
"required": false
},
"excerpt": {
"description": "The excerpt for the post.",
"type": "object",
"properties": {
"raw": {
"description": "Excerpt for the post, as it exists in the database.",
"type": "string",
"context": [
"edit"
]
},
"rendered": {
"description": "HTML excerpt for the post, transformed for display.",
"type": "string",
"context": [
"view",
"edit",
"embed"
],
"readonly": true
},
"protected": {
"description": "Whether the excerpt is protected with a password.",
"type": "boolean",
"context": [
"view",
"edit",
"embed"
],
"readonly": true
}
},
"required": false
},
"meta": {
"description": "Meta fields.",
"type": "object",
Expand Down Expand Up @@ -4379,6 +4452,40 @@ mockedApiResponse.Schema = {
},
"required": false
},
"excerpt": {
"description": "The excerpt for the post.",
"type": "object",
"properties": {
"raw": {
"description": "Excerpt for the post, as it exists in the database.",
"type": "string",
"context": [
"edit"
]
},
"rendered": {
"description": "HTML excerpt for the post, transformed for display.",
"type": "string",
"context": [
"view",
"edit",
"embed"
],
"readonly": true
},
"protected": {
"description": "Whether the excerpt is protected with a password.",
"type": "boolean",
"context": [
"view",
"edit",
"embed"
],
"readonly": true
}
},
"required": false
},
"meta": {
"description": "Meta fields.",
"type": "object",
Expand Down

0 comments on commit 5dc0cc0

Please sign in to comment.