Commit Graph

59 Commits

Author SHA1 Message Date
spacedmonkey 2949e05862 Editor: Disable lazy loading term meta in `get_block_templates`.
Pass false to the `lazy_load_term_meta` parameter given to the `WP_Query` found in `get_block_templates`. Template post types only ever have one term assigned to them. So priming term meta, does not help performance as lazy loading term meta is only useful if loading multiple terms. As `get_block_templates` is run multiple times on a block theme request, this saves processing time. 

Props spacedmonkey, andraganescu, ntsekouras, oandregal, westonruter.
Fixes #58230.
Built from https://develop.svn.wordpress.org/trunk@55817


git-svn-id: http://core.svn.wordpress.org/trunk@55329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-17 09:23:24 +00:00
oandregal 7119126dc3 Docs: describe return type of `_get_block_template_file()`.
Props: desrosj, mukesh27, costdev, johnbillion.
Fixes #57756.

Built from https://develop.svn.wordpress.org/trunk@55744


git-svn-id: http://core.svn.wordpress.org/trunk@55256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-11 09:03:26 +00:00
John Blackbourn 5ef972680a Docs: A host of corrections and improvements to inline documentation.
See #57840

Built from https://develop.svn.wordpress.org/trunk@55732


git-svn-id: http://core.svn.wordpress.org/trunk@55244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-08 22:37:24 +00:00
John Blackbourn f14f3ba995 Docs: All sorts of improvements and corrections to function and hook docs.
See #57840

Built from https://develop.svn.wordpress.org/trunk@55694


git-svn-id: http://core.svn.wordpress.org/trunk@55206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-27 23:15:17 +00:00
John Blackbourn cc24b047eb Docs: Correct and improve various documented types for properties, functions, and hooks.
See #57840

Built from https://develop.svn.wordpress.org/trunk@55693


git-svn-id: http://core.svn.wordpress.org/trunk@55205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-27 22:29:18 +00:00
oandregal dafa13a0b9 Themes: improve performance of `get_block_templates()`.
`get_block_templates()` is responsible for finding block templates that match a given search. The function receives a query parameter with the relevant metadata (slugs of the templates, areas of the template parts, etc) to find the user templates (database) and theme templates (file directory).

This function can be made more performant by changing how it works. Before this change, it processed all the block templates and discarded the ones that didn't match the query after it occurred. This commit makes it so it discards the templates that don't match the query before processing them. As a result, it only has to process the subset of templates that will be used, instead of all of them.

This change impacts any theme with block templates. TwentyTwentyThree reports a 15% improvement in Time To First Byte.

Props spacedmonkey, jorgefilipecosta, youknowriad, flixos90, mukesh27.
Fixes #57756.

Built from https://develop.svn.wordpress.org/trunk@55687


git-svn-id: http://core.svn.wordpress.org/trunk@55199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-26 14:40:19 +00:00
Sergey Biryukov f940bc822d Coding Standards: Apply various alignment corrections from `composer format`.
This fixes a few WPCS warnings along the lines of:
* Array double arrow not aligned correctly
* Equals sign not aligned with surrounding statements
* Usage of ELSE IF is discouraged; use ELSEIF instead

Follow-up to [55099], [55192], [55194], [55271].

Props davidbaumwald, jrf, SergeyBiryukov.
Fixes #57994.
Built from https://develop.svn.wordpress.org/trunk@55606


git-svn-id: http://core.svn.wordpress.org/trunk@55118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-29 07:13:23 +00:00
hellofromTonya 8031a399be Editor: Combine Date template description translations.
Combine the 2 translatable strings into 1 string. Why? The example URL does not require a separate translation. Combining makes the string easier to view in context.

Follow-up to [55500].

Props SergeyBiryukov.
See #57892.
Built from https://develop.svn.wordpress.org/trunk@55501


git-svn-id: http://core.svn.wordpress.org/trunk@55033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-09 16:55:20 +00:00
hellofromTonya 230a23206d Editor: Add more details to template descriptions.
The template descriptions in `get_default_block_template_types()` are updated to add more details. Why? These descriptions are now more prominent in 6.2 to provide a better UX experience with more helpful information.

References:
* [https://github.com/WordPress/gutenberg/pull/48934 Gutenberg PR 48934]

Follow-up to [54761], [54104], [54269], [53129], [52331], [52062].

Props ntsekouras, andrewserong, bph, davidbaumwald, greenshady, glendaviesnz, hellofromTonya, jameskoster, mamaduka, peterwilsoncc, sabernhardt, SergeyBiryukov.
Fixes #57892.
Built from https://develop.svn.wordpress.org/trunk@55500


git-svn-id: http://core.svn.wordpress.org/trunk@55032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-09 16:32:19 +00:00
hellofromTonya 956dd0d50c Site Editor: Revert r54860.
[54860] caused a regression. Changes to a parent theme's template part (i.e.e when a child theme does not override that template part) no longer saved in the Site Editor. Reverting the changeset resolves the regression.

Props mreishus, hellofromTonya, azaozz, ironprogrammer, antonvlasenko.

Fixes #57630.
See #55437.
Built from https://develop.svn.wordpress.org/trunk@55493


git-svn-id: http://core.svn.wordpress.org/trunk@55026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-08 22:45:19 +00:00
jorgefilipecosta cae1a31e55 Editor: Remove need for template prefix in get_template_hierarchy.
This commit removes the need to pass a template prefix in get_template_hierarchy.
This is required because, in some block editor usages, the template prefix is not known.

Props youknowriad, davidbaumwald, jorgefilipecosta.
Fixes #57614.
Built from https://develop.svn.wordpress.org/trunk@55194


git-svn-id: http://core.svn.wordpress.org/trunk@54727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 19:38:19 +00:00
hellofromTonya 8ddb28368a Themes: Introduce wp_theme_has_theme_json() for public consumption.
Adds `wp_theme_has_theme_json()` for public consumption, to replace the private internal Core-only `WP_Theme_JSON_Resolver::theme_has_support()` method. This new global function checks if a theme or its parent has a `theme.json` file.

For performance, results are cached as an integer `1` or `0` in the `'theme_json'` group with `'wp_theme_has_theme_json'` key. This is a non-persistent cache. Why? To make the derived data from `theme.json` is always fresh from the potential modifications done via hooks that can use dynamic data (modify the stylesheet depending on some option, settings depending on user permissions, etc.).

Also adds a new public function `wp_clean_theme_json_cache()` to clear the cache on `'switch_theme'` and `start_previewing_theme'`.

References:
* [https://github.com/WordPress/gutenberg/pull/45168 Gutenberg PR 45168] Add `wp_theme_has_theme_json` as a public API to know whether a theme has a `theme.json`.
* [https://github.com/WordPress/gutenberg/pull/45380 Gutenberg PR 45380] Deprecate `WP_Theme_JSON_Resolver:theme_has_support()`.
* [https://github.com/WordPress/gutenberg/pull/46150 Gutenberg PR 46150] Make `theme.json` object caches non-persistent.
* [https://github.com/WordPress/gutenberg/pull/45979 Gutenberg PR 45979] Don't check if constants set by `wp_initial_constants()` are defined.
* [https://github.com/WordPress/gutenberg/pull/45950 Gutenberg PR 45950] Cleaner logic in `wp_theme_has_theme_json`.

Follow-up to [54493], [53282], [52744], [52049], [50959].

Props oandregal, afragen, alexstine, aristath, azaozz, costdev, flixos90, hellofromTonya, mamaduka, mcsf, ocean90, spacedmonkey.
Fixes #56975.
Built from https://develop.svn.wordpress.org/trunk@55086


git-svn-id: http://core.svn.wordpress.org/trunk@54619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-18 11:40:10 +00:00
spacedmonkey 72948dee1e Themes: Improve performance of `_add_block_template_part_area_info` and `_add_block_template_info` functions.
Improve performance of `_add_block_template_part_area_info` and `_add_block_template_info` function by passing the `with_supports` parameter to the `WP_Theme_JSON_Resolver::get_theme_data` method. This results in hitting an existing cache and in many less calls to get_option. 

Props spacedmonkey, flixos90, SergeyBiryukov, peterwilsoncc, desrosj.
Fixes #57077.
Built from https://develop.svn.wordpress.org/trunk@54998


git-svn-id: http://core.svn.wordpress.org/trunk@54531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-15 22:55:16 +00:00
Sergey Biryukov a5c25ded41 Coding Standards: Remove redundant semicolon after `get_template_hierarchy()`.
Follow-up to [54269].

Props jrf.
See #56791.
Built from https://develop.svn.wordpress.org/trunk@54916


git-svn-id: http://core.svn.wordpress.org/trunk@54468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-30 17:36:13 +00:00
Sergey Biryukov c7457d772e Site Editor: Show correct theme per template or template part.
Child themes inherit templates and template parts from the parent theme. In Site Editor, the "Added by" column for a template defaults to displaying the child theme, even though it is inherited from the parent, creating confusion as to where the actual templates are located.

This commit ensures that the parent theme is correctly displayed in that scenario.

Follow-up to [51003], [52062].

Props ptahdunbar, WoutPitje, petaryoast, costdev, poena, audrasjb, SergeyBiryukov.
Fixes #55437.
Built from https://develop.svn.wordpress.org/trunk@54860


git-svn-id: http://core.svn.wordpress.org/trunk@54412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-21 16:50:17 +00:00
Sergey Biryukov 7836738bd9 Docs: Document the usage of globals in some functions.
This affects:
* `the_block_editor_meta_boxes()`
* `wp_generate_block_templates_export_file()`
* `WP_oEmbed_Controller::get_proxy_item()`

Follow-up to [44131], [48135], [51151], [53129].

Props krunal265.
Fixes #57082.
Built from https://develop.svn.wordpress.org/trunk@54831


git-svn-id: http://core.svn.wordpress.org/trunk@54383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-13 13:51:20 +00:00
spacedmonkey 8ea348f6db Themes: Reduce usage of `wp_get_theme` function.
Calling the `wp_get_theme` function creates a instance of the `WP_Theme` class. This can be a performance issue, if all you need is one property of the class instance. This change replaces the usage of `wp_get_theme()->get_stylesheet()` with `get_stylesheet()` to improve performance.

Props spacedmonkey, flixos90, peterwilsoncc, desrosj.
Fixes #57057.
Built from https://develop.svn.wordpress.org/trunk@54817


git-svn-id: http://core.svn.wordpress.org/trunk@54369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-11 16:26:12 +00:00
audrasjb daccffbd4a Editor: Improve Archive template description.
This changeset improves the description of the Archive template in the Site Editor to make it more accurate.

Follow-up to [52331].

Props Chaton666, webaxones, mukesh27, audrasjb, SergeyBiryukov.
Fixes #57001.

Built from https://develop.svn.wordpress.org/trunk@54761


git-svn-id: http://core.svn.wordpress.org/trunk@54313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-07 20:23:11 +00:00
Sergey Biryukov f0af926dd6 Coding Standards: Correct alignment in various files.
This fixes `Equals sign not aligned with surrounding statements` WPCS warnings, so that the output of `composer format` is clean.

Follow-up to [54445], [54476], [54494], [54522], [54652], [54687].

See #56791.
Built from https://develop.svn.wordpress.org/trunk@54754


git-svn-id: http://core.svn.wordpress.org/trunk@54306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-05 22:03:16 +00:00
jorgefilipecosta 379096eca1 Fix: Category specific templates always appear as not found.
According to the docs in developer.wordpress.org/reference/classes/wp_term_query/query WP_Term_Query:->query( string|array $query ) returns WP_Term[]|int[]|string[]|string, and we were using an inexistent object property terms making it always empty and look like the taxonomy did not exist.

Props mamaduka, mikachan, ockham, franz00.
See #56902.
Built from https://develop.svn.wordpress.org/trunk@54751


git-svn-id: http://core.svn.wordpress.org/trunk@54303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-04 18:24:12 +00:00
davidbaumwald 48ac09448b Editor: Ensure `WP_Query` and `WP_Term_Query` results are referenced properly when creating dynamic template names for use in the site editor.
[54445] updated the new dynamic template name functions used by the site editor in 6.1 to use `WP_Query` and `WP_Term_Query` instances in place of `get_posts` and `get_terms` respectively.  However, the latter functions return an array of results whereas `WP_Query` instances store their found results in a class property.  This change updates the code to reference either `$posts_query->posts` or `$terms_query->terms` where necessary.

Follow-up to [54280], [54333], [54370], [54388], and [54445].

Props bernhard-reiter, spacedmonkey, davidbaumwald.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54494


git-svn-id: http://core.svn.wordpress.org/trunk@54053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 17:30:12 +00:00
John Blackbourn f9db66d504 Docs: Various improvements to inline docblocks.
See #55646

Built from https://develop.svn.wordpress.org/trunk@54470


git-svn-id: http://core.svn.wordpress.org/trunk@54029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 09:02:14 +00:00
davidbaumwald 711c24d3a7 Editor: Dynamic site editor template names performance improvements.
This change updates `get_(posts|terms)()` to direct `WP_Query` calls and adds additional parameters to each query to improve performance.

Follow-up to [54280], [54333], [54370], and [54388].

Props spacedmonkey, peterwilsoncc.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54445


git-svn-id: http://core.svn.wordpress.org/trunk@54004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-10 15:17:13 +00:00
Peter Wilson ac8cba8791 Docs: Correct docblocks for `get_block_file_template()`.
This corrects the docblock for `get_block_file_template()` and the filters it contains: `pre_get_block_file_template` and `get_block_file_template`.

Prior to this change they were incorrectly documented with the docblocks for `get_block_template()` and its associated filters.

Props felipeelia.
Fixes #55929.


Built from https://develop.svn.wordpress.org/trunk@54380


git-svn-id: http://core.svn.wordpress.org/trunk@53939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 04:29:08 +00:00
davidbaumwald f82413b29d Editor: Make template names and descriptions dynamic, again.
In the lead up to 6.1 Beta 2, dynamic titles and descriptions for site editor templates was deemed "feature incomplete" and [54280] was reverted.  After further consideration, this code is being re-merged in preparation for Beta 3, reverting the revert in [54333].

Follow-up to [54280] and [54333].

Props bernie, ntsekouras, jorgefilipecosta, jameskoster, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54370


git-svn-id: http://core.svn.wordpress.org/trunk@53929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-03 16:36:11 +00:00
davidbaumwald bed72ed20d Editor: Revert dynamic template names and descriptions.
After discussions with the Editor Tech leads for 6.1(@bernhard-reiter, @cbravobernal, and @ndiego) and additional guidance from @hellofromtonya, the decision has been made to exclude [https://github.com/WordPress/gutenberg/pull/43862 Gutenberg PR #43862] from the pre-Beta 2 Gutenberg sync PR and revert [54280]. Why? [54280] added the feature's PHP code, but the JS package updates were not included before feature freeze(Beta 1), meaning the feature was incomplete. As the PHP code does not work without the JS package update, the feature is incomplete and missed the feature freeze deadline.

Leaving the PHP code was discussed. However, there is a risk of it needing to change which could complicate backwards compatibility in 6.2 when the feature is eventually introduced.

Follow-up to [54280].

Props hellofromTonya, bernhard-reiter, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54333


git-svn-id: http://core.svn.wordpress.org/trunk@53892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-27 16:33:10 +00:00
jorgefilipecosta 292636ff72 Editor: Make template names and descriptions dynamic.
Backports PHP changes in WordPress/gutenberg#43862 to the core. Adds a mechanism to dynamically compute names and descriptions of the author, page, single, tag, category, and taxonomy templates.

Props mcsf, ntsekouras, antonvlasenko, jameskoster.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54280


git-svn-id: http://core.svn.wordpress.org/trunk@53839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 15:45:12 +00:00
hellofromTonya 3b68d37905 Editor: Adds template types, `is_wp_suggestion`, and fallback template content.
This commit improves site editor templates by:

* Adds a post meta `is_wp_suggestion` to templates created from the site editor.

Why? To differentiate the templates created from the post editor in the Template panel in inspector controls and the templates suggested in site editor.

See [https://github.com/WordPress/gutenberg/pull/41387 Gutenberg PR 41387] for more details.

* Expands the template types that can be added to the site editor to include single custom post type and specific posts templates.

See [https://github.com/WordPress/gutenberg/pull/41189 Gutenberg PR 41189] for more details.

* Adds fallback template content on creation in site editor:
   * Introduces `get_template_hierarchy()` to get the template hierarchy for a given template slug to be created.
   * Adds a `lookup` route to `WP_REST_Templates_Controller` to get the fallback template content.

See [https://github.com/WordPress/gutenberg/pull/42520 Gutenberg PR 42520] for more details.

* Fixes a typo in default category template's description within `get_default_block_template_types()`.

See [https://github.com/WordPress/gutenberg/pull/42586 Gutenberg PR 42586] for more details.

* Changes field checks from `in_array()` to `rest_is_field_included()` in `WP_REST_Post_Types_Controller`.
* Adds an `icon` field to `WP_REST_Post_Types_Controller`

Follow-up to [53129], [52331], [52275], [52062], [51962], [43087].

Props ntsekouras, spacedmonkey, mamaduka, mburridge, jameskoster, bernhard-reiter, mcsf, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54269


git-svn-id: http://core.svn.wordpress.org/trunk@53828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 21:21:09 +00:00
desrosj 1966addc05 Coding Standards: Various alignment fixes from `composer format`.
Follow up to [53874], [54097], [54110], [54155], [54162], [54184].

See #39210, #55443, #56288, #56092, #56408, #56467, #55881.
Built from https://develop.svn.wordpress.org/trunk@54210


git-svn-id: http://core.svn.wordpress.org/trunk@53769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 19:51:09 +00:00
hellofromTonya 47d61a73ef Editor: Fix get_block_templates() to get templates for a post type.
When a post type is passed to `get_block_templates()` in the query, return only the templates that match that post type.

Fixes an issue where:
* when a block template provided by a theme has been edited by the user
* and that template has specific defined `postTypes`
* but after editing, the template was available for all post types.

Follow-up to [52062].

Props aljullu, bernhard-reiter, hellofromTonya.
Fixes #55881.
Built from https://develop.svn.wordpress.org/trunk@54184


git-svn-id: http://core.svn.wordpress.org/trunk@53743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 22:28:13 +00:00
Sergey Biryukov be113df39d Editor: Update `single` default template description.
In order to add more template types we need to update some copy from the current default templates provided.

This updates the `single` template copy as it's needed to clear up the ambiguity between the single template that is the fallback for any custom post type (including `post`) and the menu item to be added in a subsequent commit, that will allow the creation the `single-post` template and any `single_$post_type` template.

This commit backports the original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/41302 #41302: Site Editor: Update single default template copy]

Follow-up to [52062], [52331].

Props ntsekouras, bernhard-reiter, jameskoster, Mamaduka, scruffian.
Fixes #56534.
Built from https://develop.svn.wordpress.org/trunk@54104


git-svn-id: http://core.svn.wordpress.org/trunk@53663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 16:15:08 +00:00
Sergey Biryukov 08f5675e1c Editor: Ensure `get_block_templates()` returns unique templates or template parts.
The function was using the `array_column()` PHP function on an array of objects, which works as expected on PHP 7 or later, but not on PHP 5.6.

This resulted in customized templates being listed multiple times on the Templates and Template Parts screens, and being repeatedly added between lists when switching between the screens.

The issue is now resolved by replacing `array_column()` with the `wp_list_pluck()` WordPress core function, which provides consistent behavior beetween PHP versions.

Reference: [https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L626 PHP 7.0 Upgrade Notes: array_column()].

Props uofaberdeendarren, antonvlasenko, ironprogrammer, jonmackintosh, costdev, hellofromTonya, swissspidy, rudlinkon.
Fixes #56271.
Built from https://develop.svn.wordpress.org/trunk@53927


git-svn-id: http://core.svn.wordpress.org/trunk@53486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-23 14:52:12 +00:00
audrasjb d217368c6a Docs: Provide a more accurate description for `wp_is_theme_directory_ignored()`.
This function doesn't filter theme directories, it rather determines whether a directory should be ignored during export.

Props audrasjb, nareshbheda.
Fixes #56257.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53757


git-svn-id: http://core.svn.wordpress.org/trunk@53316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-22 07:18:13 +00:00
audrasjb 917e850008 Docs: Use third-person singular verbs for function descriptions in `block-template.php` and `block-template-utils.php`.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53728


git-svn-id: http://core.svn.wordpress.org/trunk@53287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 13:21:08 +00:00
audrasjb 6d9424f138 Docs: Fix indentation issues in `block-template-utils.php` docblocks, as per docs standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53727


git-svn-id: http://core.svn.wordpress.org/trunk@53286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 13:14:10 +00:00
gziolo 102004b505 Theme: Use a better method to determine the theme name during export
See the same change in the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/40829.

Props scruffian, davidbaumwald, jeremyfelt.
See #55567.



Built from https://develop.svn.wordpress.org/trunk@53402


git-svn-id: http://core.svn.wordpress.org/trunk@52991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-17 12:10:14 +00:00
Sergey Biryukov e0d13f8b59 Coding Standards: Correct alignment in various files.
This fixes an `Array double arrow not aligned correctly` WPCS warning.

Follow-up to [53075], [53084], [53091], [53094], [53155], [53129].

See #54728.
Built from https://develop.svn.wordpress.org/trunk@53197


git-svn-id: http://core.svn.wordpress.org/trunk@52786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-17 15:07:08 +00:00
gziolo 9e3c5a4215 Editor: Add functionality required for theme export in the site editor
This bring across changes to theme export functionality, and related code, and tests. Relates issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/39889.

Props scruffian, timothyblynjacobs, oandregal, ajlende, zieleadam.
See #55505.


Built from https://develop.svn.wordpress.org/trunk@53129


git-svn-id: http://core.svn.wordpress.org/trunk@52718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 10:38:00 +00:00
davidbaumwald 29574d03bd Site Editor: Rename the default attachment template from "Media" to "Attachment".
Follow-up to [52062].

Props scruffian, costdev.
Fixes #55373.
Built from https://develop.svn.wordpress.org/trunk@52923


git-svn-id: http://core.svn.wordpress.org/trunk@52512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-11 23:30:07 +00:00
Sergey Biryukov 08b97d13b8 Site Editor: Fix typo in the description of the tag template.
Follow-up to [52331].

Props scruffian.
Fixes #55374.
Built from https://develop.svn.wordpress.org/trunk@52922


git-svn-id: http://core.svn.wordpress.org/trunk@52511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-11 15:24:02 +00:00
audrasjb 0e9a48e0cb Docs: Docblock corrections for `get_block_file_template()`.
Follow-up to [52324].

Props johnbillion, SergeyBiryukov, costdev.
Fixes #54879.

Built from https://develop.svn.wordpress.org/trunk@52631


git-svn-id: http://core.svn.wordpress.org/trunk@52219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-24 15:28:02 +00:00
audrasjb 99bac7e17c Docs: Replace "Current theme" with "Active theme" in various DocBlocks.
This change replaces "Current theme" with "Active theme" in various DocBlocks for better consistency with user-facing strings.

Follow-up to [52580].

Props Presskopp, audrasjb, costdev.
Fixes #54831.
See #54770.

Built from https://develop.svn.wordpress.org/trunk@52610


git-svn-id: http://core.svn.wordpress.org/trunk@52198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-20 23:53:05 +00:00
hellofromTonya 3abe551097 Site Editor: Fix typo in home template translatable description.
The home template's description should be: "Displays as the site's home page, or as the Posts page when a static home page isn't set." This commit fixes the typo changing "it" to "isn't".

Follow-up to [52331].

Props kharisblank, talldanwp.
Fixes #54787.
Built from https://develop.svn.wordpress.org/trunk@52554


git-svn-id: http://core.svn.wordpress.org/trunk@52144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-11 15:18:03 +00:00
noisysocks 935058d178 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Image block: Set image display to grid when no alignment sent to properly align caption on resize
- Update and align template descriptions
- Site Editor - prevent loading state from showing the admin menu.
- Add client side routing for Site Editor
- Navigation: Add clearance for appender in submenus.
- Fix CSS Custom Properties for presets in the site editor
- Add/navigation blocks post processing after migration from menu items
- Allow selector ordering to ensure theme.json root selector margin takes precedence 
- Do not remove theme presets if defaults are hidden
- Format library: fix unsetting highlight color
- FSE: Fix template resolution to give precedence to child theme PHP templates over parent theme block templates with equal specificity
- ColorPalette: Improving accessibility and visibility
- Update: Make the color popover on the gradient picker appear as expected
- Site Editor: Display a notice if export fails
- Fix docs and function naming for gallery block registration in PHP
- Switch to addEventListener for load event in the navigation block view script
- Fix mistake in _remove_theme_attribute_in_block_template_content
- Better synchronisation between Gutenberg and Core code
- Move the block page templates hook into compat/5.9 folder
- Moves to the template loader hooks and functions into lib/compat folder
- Refactor the gutenberg_is_fse_theme function to use wp_is_block_theme
- Site Editor: Update support doc URL in Welcome Guide
- Global Styles: Add Welcome Guide toggle
- Hide remove control point when removing would break gradient control
- Don't request the deprecated navigation areas endpoint outside of the Gutenberg plugin
- Image: Fix resizer controls being hidden in Safari when switching between alignments
- Remove Navigation Menus from WP Admin sidebar
- Site Editor: Hide the block appender in the Template Part editor
- Site Editor: Use server definition for the Template Areas
- Synchronize wp_is_block_theme and block-templates block support with Core
- E2E: Retry login again after a bad nonce request to prevent intermittent test failures 
- Fix theme requirement validation with WP 5.8
- Fix WP 5.9 check for conditionally running code
- Fix post comment form input width
- Border Style Control: Update styling for consistency with border width control
- Fix form-submit styles by adding button classes to the submit-button in post-comments block
- Site Editor: Fix edit template part link in header dropdown
- Move duotone palette to the bottom of global styles gradients
- Fix how appearanceTools works
- Move WP 5.9 wp-admin menus compatibility code to lib/compat folder
- Revert "Site Editor: Set the <title> on the list page to be same as the CPT name"
- Site Editor: Document Actions: add SR text to heading 1
- Do not register global styles CPT in WordPress 5.9
- Global Styles: Move the 'Edit colors' button to a standard menu item
- Fix styles for previews and patterns
- Site Editor: Fix failing E2E test
- Templates: Search for old template names in the parent theme too
- Remove 4 instances of 'gutenberg' text domain from WordPress core
- Fix content loss when ungrouping template parts or reusable blocks
- Simplify the RESET_BLOCK action to fix template part focus mode content loss
- [Global Styles]: Make Blocks section more distinguishable
- Only use block markup for comment form button when using a block theme
- Navigation: Fix vertical alignment of page list in modal.
- Fix: ToggleGroupControl active state
- Remove gutenberg_ prefix from @wordpress/block-library

Props ocean90, oandregal, hellofromtonya, youknowriad.
See #54487.

Built from https://develop.svn.wordpress.org/trunk@52364


git-svn-id: http://core.svn.wordpress.org/trunk@51956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 01:57:26 +00:00
spacedmonkey 40b22d1209 REST API: Ensure that the export template endpoint returns a valid WP_Error object.
Ensure that the export template endpoint returns a WP_Error object, including code and message, so that the site editor can display an error message. 
Add some basic unit tests to ensure that permission checks are working as expected. 

Follow-up to [52286].

Props Spacedmonkey, dlh, hellofromTonya , Mamaduka, TimothyBlynJacobs.
Fixes #54448.


Built from https://develop.svn.wordpress.org/trunk@52340


git-svn-id: http://core.svn.wordpress.org/trunk@51932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 18:38:02 +00:00
John Blackbourn 39bff93b6b Docs: Various inline documentation corrections and improvements.
See #53399

Built from https://develop.svn.wordpress.org/trunk@52332


git-svn-id: http://core.svn.wordpress.org/trunk@51924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:20:02 +00:00
youknowriad bc3356601e Site Editor: Update the block template descriptions.
Align the template descriptions with the latest changes from the Gutenberg plugin.

Props jameskoster, SergeyBiryukov.
See #54335.

Built from https://develop.svn.wordpress.org/trunk@52331


git-svn-id: http://core.svn.wordpress.org/trunk@51923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:12:04 +00:00
noisysocks 3060ce0b59 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Gallery block: turn on auto-migration of v1 Gallery blocks to v2 format when edited
- Add accessible labelling to submenu buttons.
- Improve performance of wp_navigation lookup. 
- Various inline docblock corrections
- Use core version of template and template part post types and REST endpoints for WP 5.9, with back compat for 5.8
- Gradients: Enable adding custom gradient when gradients are disabled
- Custom color palette: add default color name
- Color Picker: Re-instate debounce and controlled value to fix issue with gradient picker
- Add aria-current="page" to active navigation item
- Site Editor: Templat list fallback to slug
- Fix: Custom color picker popover position
- Fix: php 5.6 error in theme JSON class.
- Update the WP_Theme_JSON_Gutenberg class to be like the core one
- Update the WP_Theme_JSON_Resolver_Gutenberg class to be like the core one
- Move Global Styles code to lib/compat/wordpress-5.9 folder
- E2E Tests: Fix failing image e2e test by waiting for required element
- Navigation: Try removing absorb toolbar prop.
- Navigation: Fix navigation justifications.
- Fix wordbreak for URLs
- Polish unset color indicator.
- Template revert flow: Make label description source agnostic
- [Block Library - Navigation]: Fix vertical layout
- Add: Corners to custom color picker popover
- Add: Missing margin to the color picker clear button
- Gradient: Fix clearing a custom gradient from throwing a React warning
- [Block Library]: Rename Query Pagination blocks
- PHP Unit Tests: Use global transients 
- Remove CSS that causes conflict with theme.json
- Add actions which fire during the loading process of block template parts
- Fix usage of useSetting('color.palette')
- Update micromodal, include click-through fix
- Site Editor: Remove unused PHP code
- Don't try and render unstable location if Nav block has ID
- Fix gutenberg prefixed function references in core
- Card: support the extraSmall option for the size prop
- Gallery block: enable the new gallery block by default if running in core 
- Block fixtures: Change port to 8889 to placate KSES
- Full Site Editing: Remove block template resolution unit tests
- Site Editor: Sync export API

See #54487.

Built from https://develop.svn.wordpress.org/trunk@52324


git-svn-id: http://core.svn.wordpress.org/trunk@51916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-06 06:20:27 +00:00
audrasjb 9a9afacf38 Docs: Replace `@since 5.9` with `@since 5.9.0` in `block-template-utils.php`.
Follow-up to [52317], [52275], [52062].

See #53399.

Built from https://develop.svn.wordpress.org/trunk@52318


git-svn-id: http://core.svn.wordpress.org/trunk@51910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 22:26:59 +00:00
audrasjb a945234aba Docs: Miscellaneous Docblock corrections for `block-template-utils.php` file.
Follow-up to [52275], [52062].

See #53399.

Built from https://develop.svn.wordpress.org/trunk@52317


git-svn-id: http://core.svn.wordpress.org/trunk@51909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 22:09:59 +00:00