In `block_has_support()` docblock, the `$feature` parameter is an array, not a string.
Props Soean, audrasjb.
Fixes#56307.
See #55646.
git-svn-id: https://develop.svn.wordpress.org/trunk@53799 602fd350-edb4-49c9-b593-d223f7449a82
When registering block through PHP, using `register_block_type` function, newly introduced `ancestor` block setting in `block.json` was not recognised. It worked though, when block is registered from JavaScript.
Props lovor, annezazu.
Fixes#56184.
git-svn-id: https://develop.svn.wordpress.org/trunk@53718 602fd350-edb4-49c9-b593-d223f7449a82
A SQL syntax error happened when a post has no comments and "Break comments into pages" is checked in Settings > Discussion. The fix sets the `'paged'` query arg only when there are comments. When there are no comments, `WP_Comment_Query` sets the default `'paged'` value to `1`.
Props bernhard-reiter, luisherranz, czapla, cbravobernal, davidbaumwald, hellofromTonya.
Follow-up to [53142], [53138].
Fixes#55658.
git-svn-id: https://develop.svn.wordpress.org/trunk@53336 602fd350-edb4-49c9-b593-d223f7449a82
This changeset clarifies the expected type for the first parameter passed to `serialize_block()` and `serialize_blocks()` functions.
Props manooweb.
Fixes#55648.
See #54729.
git-svn-id: https://develop.svn.wordpress.org/trunk@53332 602fd350-edb4-49c9-b593-d223f7449a82
Update `build_comment_query_vars_from_block()` to show previews of unmoderated comments to the original author of the comment. This duplicates the existing logic in `wp_list_comments()`.
Props darerodz, bernhard-reiter, czapla.
Fixes#55634.
git-svn-id: https://develop.svn.wordpress.org/trunk@53298 602fd350-edb4-49c9-b593-d223f7449a82
As a result of [52741] and [52743], `wp_enqueue_block_support_styles()` was moved to `wp-includes/script-loader.php`. However, `wp_enqueue_block_style()` was still defined in `wp-includes/blocks.php`. This changeset also moves `wp_enqueue_block_support_styles()` to `wp-includes/script-loader.php` for better consistency.
Follow-up to [52741], [52743].
Props SergeyBiryukov, mukesh27, audrasjb.
Fixes#55182.
See #55148.
git-svn-id: https://develop.svn.wordpress.org/trunk@53234 602fd350-edb4-49c9-b593-d223f7449a82
The code editor reported this issue while mamduka was browsing the blocks.php file. PHP considers variables undefined until a value is assigned (or the global keyword is used).
Follow-up for [53091].
Props mamaduka, peterwilsoncc.
See 55567.
git-svn-id: https://develop.svn.wordpress.org/trunk@53211 602fd350-edb4-49c9-b593-d223f7449a82
This fixes an `Array double arrow not aligned correctly` WPCS warning.
Follow-up to [53075], [53084], [53091], [53094], [53155], [53129].
See #54728.
git-svn-id: https://develop.svn.wordpress.org/trunk@53197 602fd350-edb4-49c9-b593-d223f7449a82
Related Gutenberg issue: https://github.com/WordPress/gutenberg/issues/39889.
Backporting changes from the Gutenberg plugin:
- new Block Patterns REST API endpoint
- new Block Pattern Categories REST API endpoint
- updates to Query Loop related patterns
- support for custom taxonomies in Query Loop block
Props hellofromtonya, peterwilsoncc, ntsekouras, zieladam, ironprogrammer, spacedmonkey, timothyblynjacobs, antonvlasenko, jsnajdr.
See #55505.
git-svn-id: https://develop.svn.wordpress.org/trunk@53152 602fd350-edb4-49c9-b593-d223f7449a82
Backports changes from Gutenberg to add functions required by Comment Query Loop and related blocks. Related unit tests depends on the new blocks and they will get added seperately.
Props darerodz, timothyblynjacobs.
See #55505.
git-svn-id: https://develop.svn.wordpress.org/trunk@53138 602fd350-edb4-49c9-b593-d223f7449a82
Fixes the issue when you register blocks with `block.json` in your theme. There is no longer an assets's URL error because it resolves correctly in relation to the theme where it is located.
Props fabiankaegy, ocean90, whoisnegrello, audrasjb, peterwilsoncc,
Fixes#54647, #55513.
git-svn-id: https://develop.svn.wordpress.org/trunk@53091 602fd350-edb4-49c9-b593-d223f7449a82
Both CSS and JS URLs were totally broken for some of the newer blocks (e.g. the navigation block in the 2022 theme) when WP core is outside of the current directory using a different prefix.
Props pgpagely, Mamaduka.
Fixes#55311.
git-svn-id: https://develop.svn.wordpress.org/trunk@52939 602fd350-edb4-49c9-b593-d223f7449a82
This commit applies feedback given to commit 52741. It changes the new function name, the file where it is located, and improves its documentation and marks.
Follow-up to [52741].
Props hellofromtonya, swissspidy, oandregal.
See #55148.
git-svn-id: https://develop.svn.wordpress.org/trunk@52743 602fd350-edb4-49c9-b593-d223f7449a82
The dynamic block styles for layout and elements should be loaded in the head for block themes. While that should also be the case for classic themes, the current mechanism we use (render_block) does not allow us to do that, hence, this PR doesn't change anything for them and will be loaded the body.
Props oandregal, youknowriad, wpsoul.
Fixes#55148.
git-svn-id: https://develop.svn.wordpress.org/trunk@52741 602fd350-edb4-49c9-b593-d223f7449a82
When providing file paths to scripts (editorScript, script or viewScript), when there is a trailing ./ included then there was a different md5 generated for the file that didn't match the one used with the file generated in the translations folder.
Props Rahe.
See #54797.
git-svn-id: https://develop.svn.wordpress.org/trunk@52699 602fd350-edb4-49c9-b593-d223f7449a82
In `wp_enqueue_block_style` when `rtl` versions of CSS files are detected, `wp_style_add_data` is called to add the metadata to the registered sheet. However, the stylesheet `handle` argument is misspelled as `hanle`. This change corrects the argument name.
Props omaeyusuke.
Fixes#54786.
git-svn-id: https://develop.svn.wordpress.org/trunk@52558 602fd350-edb4-49c9-b593-d223f7449a82
In a block theme, additional block styles registered using the `wp_enqueue_block_style` function should only get printed when the block exists on a page. However, they currently always get rendered.
This commit is a backport from Gutenberg that fixes the issue by printing the styles when a block renders.
Follow-up to [52069].
Props poena, aristath, Mamaduka.
Fixes#54787.
git-svn-id: https://develop.svn.wordpress.org/trunk@52556 602fd350-edb4-49c9-b593-d223f7449a82
Adds missing `@since` mention to `wp_enqueue_block_style()` and `_wp_multiple_block_styles()`, and a few other minor changes.
Follow-up to [52069].
See #53359.
git-svn-id: https://develop.svn.wordpress.org/trunk@52354 602fd350-edb4-49c9-b593-d223f7449a82
- First pass at adding the site editor from the Gutenberg plugin to
wp-admin/site-editor.php.
- Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.
Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.
git-svn-id: https://develop.svn.wordpress.org/trunk@52069 602fd350-edb4-49c9-b593-d223f7449a82
Adds the required infrastructure to render block-based themes. This is sourced
from the Gutenberg plugin.
Fixes#54335.
Props bernhard-reiter, youknowriad, ntsekouras, hellofromtonya.
git-svn-id: https://develop.svn.wordpress.org/trunk@52062 602fd350-edb4-49c9-b593-d223f7449a82
Fixes a crash that is happening when using an FSE theme because a function required is missing. Ports the function from the Gutenberg plugin.
Props oandregal, youknowriad.
git-svn-id: https://develop.svn.wordpress.org/trunk@52057 602fd350-edb4-49c9-b593-d223f7449a82
The `serializeAttributes()` function in JavaScript uses `JSON.stringify`, which does not encode slashes and unicode characters by default. This resulted in the PHP serialization through `json_encode()` producing different results.
This also switches from `json_encode()` to `wp_json_encode()` to prevent failures when any non UTF-8 characters are included.
Props kevinfodness, SergeyBiryukov, timothyblynjacobs.
Fixes#53936.
git-svn-id: https://develop.svn.wordpress.org/trunk@51674 602fd350-edb4-49c9-b593-d223f7449a82
We integrated variations with block types and the corresponding REST API endpoint in #52688. It's a follow-up patch to add missing support to the `block.json` metadata file when using `register_block_type`.
Some fields for variations are translatable.Therefore, i18n schema was copied over from Gutenberg: https://github.com/WordPress/gutenberg/blob/trunk/packages/blocks/src/api/i18n-block.json. The accompanying implementation was adapted as `translate_settings_using_i18n_schema`.
Props: gwwar, swissspidy, schlessera, jorgefilipecosta.
Fixes#53238.
git-svn-id: https://develop.svn.wordpress.org/trunk@51599 602fd350-edb4-49c9-b593-d223f7449a82
It aligns with the changes proposed added in Gutenberg: https://github.com/WordPress/gutenberg/pull/33293.
The idea here is to split the growing webpack config into two parts: blocks and packages.
We need to add handling for JavaScript files that are going to be used with blocks on the frontend. They didn't work quite well with the current setup for entry points created for packages.
As part of the effort, it adds support for `viewScript` in `block.json` metadata file that is later translated to `$view_script` in `WP_Block_Type` class and exposed as `view_script` from the REST API endpoint for block types.
Props youknowriad, desrosj, aristath.
Fixes#53690.
git-svn-id: https://develop.svn.wordpress.org/trunk@51501 602fd350-edb4-49c9-b593-d223f7449a82
[51378] contained merge info it shouldn't and accidentally a line of code from one of those commits that another one had changed.
See #53604.
Unprops jorbin.
git-svn-id: https://develop.svn.wordpress.org/trunk@51379 602fd350-edb4-49c9-b593-d223f7449a82
A warpper is the traditional home of a neditor. They generally are optimized for supporting the good quality content that a neditor requires to survive. Some warppers feel like they have been around forever but have laid a foundation for newer warppers. A specific Russian warppers is known for having a wide footprint and touching almost everything. Warppers were originally only found subversioned underground, but they have been able to GIT above ground in the last few years.
The number of warpers in the world is small, but without them the neditor would never survive.
See [23105], [51375], #53604.
Props SergeyBiryukov.
git-svn-id: https://develop.svn.wordpress.org/trunk@51378 602fd350-edb4-49c9-b593-d223f7449a82
This introduces the `excerpt_allowed_wrapper_blocks` filter for controlling which blocks should be considered wrapper blocks.
Wrapper blocks and their nested contents are not stripped by `excerpt_remove_blocks()`, allowing their contents to appear in generated excerpts.
Follow up to [51348].
Props aristath, jorbin.
See #53604.
git-svn-id: https://develop.svn.wordpress.org/trunk@51375 602fd350-edb4-49c9-b593-d223f7449a82
Includes the following fixes:
- Query Block: Type validation of `WP_Query` parameters.
Props ntsekouras, stevehenty, peterwilsoncc, desrosj.
Fixes#53397.
git-svn-id: https://develop.svn.wordpress.org/trunk@51362 602fd350-edb4-49c9-b593-d223f7449a82
This improves the logic within `excerpt_remove_blocks()` to better handle `innerBlocks`. This prevents an empty excerpt from being returned when `core/columns`, `core/column`, and `core/group` blocks are present.
This issue has been surfaced in the Query Loop block, where excerpts can be set to display.
Props aristath.
Fixes#53604.
git-svn-id: https://develop.svn.wordpress.org/trunk@51348 602fd350-edb4-49c9-b593-d223f7449a82
[51259] introduced a PHP notice that was not actually fixed by [51265]. Reverting these changes in order to investigate further.
See #53397.
git-svn-id: https://develop.svn.wordpress.org/trunk@51268 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a PHP notice caused by the `viewScript` for the `core/file` block having `.min.js` instead of just `.js`.
`register_block_script_handle()` was incorrectly looking for `view.min.asset.php`, which does not exist, and caused the `_doing_it_wrong()` notice.
This adds a check for `.min.js` in the `viewScript` field of `block.json` and corrects it to `.js` in order to match the expected pattern of `view.asset.php` until a more permanent fix can be created.
Follow up to [51259].
Props ipstenu, pbiron, peterwilsoncc.
See #53397.
git-svn-id: https://develop.svn.wordpress.org/trunk@51267 602fd350-edb4-49c9-b593-d223f7449a82
This updates `register_block_style_handle()` to use the `version` value provided in the `$metadata` parameter for non-Core blocks (when present). This removes the requirement to use `filemtime()` to generate a unique version.
When `version` is not defined within `$metadata`, the script version will fallback to using the current version of WordPress.
The block version should be considered similar to the one specified by plugin developers within the header of the main plugin file.
Props hellofromTonya, gziolo, jorbin, desrosj, walbo, aristath.
Fixes#53507.
git-svn-id: https://develop.svn.wordpress.org/trunk@51262 602fd350-edb4-49c9-b593-d223f7449a82
This also adds support for the viewScript for blocks fixing
the PDF preview for file blocks.
Props desrosj, gziolo.
See #53397.
git-svn-id: https://develop.svn.wordpress.org/trunk@51259 602fd350-edb4-49c9-b593-d223f7449a82