Skip to content

Commit 83ff21c

Browse files
committed
prep build 02/28
2 parents ec07350 + d899945 commit 83ff21c

File tree

109 files changed

+3945
-4809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+3945
-4809
lines changed

changelog.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
== Changelog ==
22

3+
= 15.2.2 =
4+
5+
6+
7+
## Changelog
8+
9+
### Bug Fixes
10+
11+
#### Layout
12+
- Post Editor: Update postContentBlock check to see if the block is valid. ([48386](https://github.com/WordPress/gutenberg/pull/48386))
13+
14+
15+
## First time contributors
16+
17+
The following PRs were merged by first time contributors:
18+
19+
20+
21+
## Contributors
22+
23+
The following contributors merged PRs in this release:
24+
25+
@andrewserong
26+
27+
328
= 15.2.1 =
429

530

docs/how-to-guides/curating-the-editor-experience.md

Lines changed: 110 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ Users have the ability to lock and unlock blocks via the editor. The locking UI
1212

1313
![Image of locking interface](https://raw.githubusercontent.com/WordPress/gutenberg/HEAD/docs/assets/Locking%20interface.png?raw=true)
1414

15-
Keep in mind that each block you want to lock will need to be individually locked as desired. There is not a way to mass lock blocks currently.
15+
Keep in mind that you can apply locking options to blocks nested inside of a containing block by turning on the "Apply to all blocks inside" option. However, you cannot mass lock blocks otherwise.
16+
17+
**Lock the ability to edit certain blocks**
18+
19+
Alongside the ability to lock moving or removing blocks, the [Navigation Block](https://github.com/WordPress/gutenberg/pull/44739) and [Reusable block](https://github.com/WordPress/gutenberg/pull/39950) have an additional capability: lock the ability to edit the contents of the block. This locks the ability to make changes to any blocks inside of either block type.
1620

1721
**Apply block locking to patterns or templates**
1822

@@ -126,31 +130,31 @@ Since theme.json acts as a configuration tool, there are numerous ways to define
126130
"schema": "https://schemas.wp.org/trunk/theme.json",
127131
"version": 2,
128132
"settings": {
129-
"color": {
130-
"custom": true,
131-
"customDuotone": true
132-
},
133+
"color": {
134+
"custom": true,
135+
"customDuotone": true
136+
},
133137
"blocks": {
134-
"core/post-featured-image": {
135-
"color": {
136-
"duotone": [
138+
"core/post-featured-image": {
139+
"color": {
140+
"duotone": [
137141
{
138-
"colors": [ "#282828", "#ff5837" ],
139-
"slug": "black-and-orange",
140-
"name": "Black and Orange"
141-
},
142+
"colors": [ "#282828", "#ff5837" ],
143+
"slug": "black-and-orange",
144+
"name": "Black and Orange"
145+
},
142146
{
143-
"colors": [ "#282828", "#0288d1" ],
144-
"slug": "black-and-blue",
145-
"name": "Black and Blue"
146-
}
147+
"colors": [ "#282828", "#0288d1" ],
148+
"slug": "black-and-blue",
149+
"name": "Black and Blue"
150+
}
147151
],
148-
"customDuotone": true,
149-
"custom": true
152+
"customDuotone": true,
153+
"custom": true
150154
}
151155
}
152-
}
153-
}
156+
}
157+
}
154158
}
155159
```
156160

@@ -161,31 +165,31 @@ Since theme.json acts as a configuration tool, there are numerous ways to define
161165
"schema": "https://schemas.wp.org/trunk/theme.json",
162166
"version": 2,
163167
"settings": {
164-
"color": {
165-
"custom": true,
166-
"customDuotone": true
167-
},
168+
"color": {
169+
"custom": true,
170+
"customDuotone": true
171+
},
168172
"blocks": {
169-
"core/post-featured-image": {
170-
"color": {
171-
"duotone": [
173+
"core/post-featured-image": {
174+
"color": {
175+
"duotone": [
172176
{
173-
"colors": [ "#282828", "#ff5837" ],
174-
"slug": "black-and-orange",
175-
"name": "Black and Orange"
176-
},
177+
"colors": [ "#282828", "#ff5837" ],
178+
"slug": "black-and-orange",
179+
"name": "Black and Orange"
180+
},
177181
{
178-
"colors": [ "#282828", "#0288d1" ],
179-
"slug": "black-and-blue",
180-
"name": "Black and Blue"
181-
}
182+
"colors": [ "#282828", "#0288d1" ],
183+
"slug": "black-and-blue",
184+
"name": "Black and Blue"
185+
}
182186
],
183-
"customDuotone": false,
184-
"custom": false
187+
"customDuotone": false,
188+
"custom": false
185189
}
186190
}
187-
}
188-
}
191+
}
192+
}
189193
}
190194
```
191195

@@ -204,27 +208,27 @@ Continuing the examples with duotone, this means you could allow full access to
204208
"schema": "https://schemas.wp.org/trunk/theme.json",
205209
"version": 2,
206210
"settings": {
207-
"color": {
208-
"custom": true,
209-
"customDuotone": true
210-
},
211+
"color": {
212+
"custom": true,
213+
"customDuotone": true
214+
},
211215
"blocks": {
212-
"core/image": {
213-
"color": {
214-
"duotone": [],
215-
"customDuotone": true,
216-
"custom": true
216+
"core/image": {
217+
"color": {
218+
"duotone": [],
219+
"customDuotone": true,
220+
"custom": true
217221
}
218222
},
219223
"core/post-featured-image": {
220-
"color": {
221-
"duotone": [],
222-
"customDuotone": false,
223-
"custom": false
224+
"color": {
225+
"duotone": [],
226+
"customDuotone": false,
227+
"custom": false
224228
}
225229
}
226-
}
227-
}
230+
}
231+
}
228232
}
229233
```
230234

@@ -278,6 +282,52 @@ When using theme.json in a block or classic theme, these settings will stop the
278282

279283
To enable something from the above, just set whatever value you want to change to `true` for more granularity.
280284

285+
## Limiting interface options with theme.json filters
286+
287+
The theme.json file is a great way to control interface options, but it only allows for global or block-level modifications, which can be limiting in some scenarios.
288+
289+
For instance, in the previous section, color and typography controls were disabled globally using theme.json. But let's say you want to enable color settings for users who are Administrators.
290+
291+
To provide more flexibility, WordPress 6.1 introduced server-side filters allowing you to customize theme.json data at four different data layers.
292+
293+
- `wp_theme_json_data_default` - Hooks into the default data provided by WordPress
294+
- `wp_theme_json_data_blocks` - Hooks into the data provided by blocks.
295+
- `wp_theme_json_data_theme` - Hooks into the data provided by the current theme.
296+
- `wp_theme_json_data_user` - Hooks into the data provided by the user.
297+
298+
In the following example, the data from the current theme's theme.json file is updated using the `wp_theme_json_data_theme` filter. Color controls are restored if the current user is an Administrator.
299+
300+
```
301+
// Disable color controls for all users except Administrators.
302+
function example_filter_theme_json_data_theme( $theme_json ){
303+
$is_administrator = current_user_can( 'edit_theme_options' );
304+
305+
if ( $is_administrator ) {
306+
$new_data = array(
307+
'version' => 2,
308+
'settings' => array(
309+
'color' => array(
310+
'background' => true,
311+
'custom' => true,
312+
'customDuotone' => true,
313+
'customGradient' => true,
314+
'defaultGradients' => true,
315+
'defaultPalette' => true,
316+
'text' => true,
317+
),
318+
),
319+
);
320+
}
321+
322+
return $theme_json->update_with( $new_data );
323+
}
324+
add_filter( 'wp_theme_json_data_theme', 'example_filter_theme_json_data_theme' );
325+
```
326+
327+
The filter receives an instance of the `WP_Theme_JSON_Data class` with the data for the respective layer. Then, you pass new data in a valid theme.json-like structure to the `update_with( $new_data )` method. A theme.json version number is required in `$new_data`.
328+
329+
Read more about this functionality in the [Filters for theme.json data dev note](https://make.wordpress.org/core/2022/10/10/filters-for-theme-json-data/).
330+
281331
## Remove access to functionality
282332

283333
**Remove access to the template editor**
@@ -300,11 +350,13 @@ To fully remove patterns bundled with WordPress core from being accessed in the
300350

301351
## Utilizing patterns
302352

303-
**Prioritize post content patterns for new pages**
353+
**Prioritize starter patterns for any post type**
354+
355+
When a user creates new content, regardless of post type, they are met with an empty canvas. However, that experience can be improved thanks to the option to have patterns from a specific type prioritized upon creation of a new piece of content. The modal appears each time the user creates a new item when there are patterns on their website that declare support for the `core/post-content` block types. By default, WordPress does not include any of these patterns, so the modal will not appear without at least two of these post content patterns being added.
304356

305-
When a user creates a page, they are met with an empty page. However, that experience can be improved thanks to the option to have patterns from a specific type prioritized upon page creation in a modal. The modal appears each time the user creates a new page when there are patterns on their website that declare support for the core/post-content block types. By default, WordPress 6.0 does not include any of these patterns, so the modal will not appear without some of these post content patterns being added.
357+
To opt into this, include `core/post-content` in the Block Types for your pattern. From there you can control which post types the pattern should show up for via the Post Types option. [Here's an example of a pattern](https://gist.github.com/annezazu/ead4c4965345251ec999b716c0c84f32) that would appear when creating a new post.
306358

307-
Read more about this functionality in the [Page creation patterns in WordPress 6.0 dev note](https://make.wordpress.org/core/2022/05/03/page-creation-patterns-in-wordpress-6-0/).
359+
Read more about this functionality in the [Page creation patterns in WordPress 6.0 dev note](https://make.wordpress.org/core/2022/05/03/page-creation-patterns-in-wordpress-6-0/) and [note that WordPress 6.1 brought this functionality to all post types](https://make.wordpress.org/core/2022/10/10/miscellaneous-editor-changes-for-wordpress-6-1/#start-content-patterns-for-all-post-types).
308360

309361
**Lock patterns**
310362

@@ -330,3 +382,4 @@ Keep in mind that the above approaches can be combined as you see fit. For examp
330382

331383
- [Builder Basics – Working with Templates in Full Site Editing (Part 3)](https://wordpress.tv/2022/05/24/nick-diego-builder-basics-working-with-templates-in-full-site-editing-part-3/)
332384
- [Core Editor Improvement: Curated experiences with locking APIs & theme.json](https://make.wordpress.org/core/2022/02/09/core-editor-improvement-curated-experiences-with-locking-apis-theme-json/)
385+
- [Learn WordPress session on Curating the Editor Experience](https://wordpress.tv/2022/07/22/nick-diego-curating-the-editor-experience/)

docs/reference-guides/core-blocks.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,15 @@ Post terms. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages
584584
- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
585585
- **Attributes:** prefix, separator, suffix, term, textAlign
586586

587+
## Time To Read
588+
589+
Show minutes required to finish reading the post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-time-to-read))
590+
591+
- **Name:** core/post-time-to-read
592+
- **Category:** theme
593+
- **Supports:** ~~html~~, ~~multiple~~
594+
- **Attributes:** textAlign
595+
587596
## Post Title
588597

589598
Displays the title of a post, page, or any other content-type. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-title))

lib/blocks.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function gutenberg_reregister_core_block_types() {
9090
'post-featured-image.php' => 'core/post-featured-image',
9191
'post-navigation-link.php' => 'core/post-navigation-link',
9292
'post-terms.php' => 'core/post-terms',
93+
'post-time-to-read.php' => 'core/post-time-to-read',
9394
'post-title.php' => 'core/post-title',
9495
'query.php' => 'core/query',
9596
'post-template.php' => 'core/post-template',

lib/compat/wordpress-6.2/site-editor.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,3 @@ function gutenberg_site_editor_unset_homepage_setting( $settings, $context ) {
2222
return $settings;
2323
}
2424
add_filter( 'block_editor_settings_all', 'gutenberg_site_editor_unset_homepage_setting', 10, 2 );
25-
26-
/**
27-
* Overrides the site editor initialization for WordPress 6.2 and cancels the redirection.
28-
* The logic of this function is not important, we just need to remove the redirection from core.
29-
*
30-
* @param string $location Location.
31-
*
32-
* @return string Updated location.
33-
*/
34-
function gutenberg_prevent_site_editor_redirection( $location ) {
35-
if ( strpos( $location, 'site-editor.php' ) !== false && strpos( $location, '?' ) !== false ) {
36-
return add_query_arg(
37-
array( 'postId' => 'none' ),
38-
admin_url( 'site-editor.php' )
39-
);
40-
}
41-
42-
return $location;
43-
}
44-
45-
add_filter( 'wp_redirect', 'gutenberg_prevent_site_editor_redirection', 1 );

0 commit comments

Comments
 (0)