This fixes a regression introduced in [50996] where sites that have been opted-out of the block-based widget editor experienced an “Invalid value.” error when adding a new widget to a sidebar in the Customizer.
This was caused by the early return value was changed to `null` from `$value` when set to an empty `array`, resulting in the widget being evaluated as invalid elsewhere.
Props jamesros161, caseymilne, naoki0h, ixkaito, zieladam, noisysocks, hellofromTonya.
Fixes#53479.
git-svn-id: https://develop.svn.wordpress.org/trunk@51232 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a bug where the “Move To” dialogue was empty when a theme has multiple widget areas.
Props kevin940726, noisysocks, hellofromTonya.
Fixes#53487.
git-svn-id: https://develop.svn.wordpress.org/trunk@51228 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a "Call to undefined method" fatal error when running the tests with PHPUnit 5.4.x, which WordPress still supports as the minimum version.
Follow-up to [48945], [48947].
See #52625.
git-svn-id: https://develop.svn.wordpress.org/trunk@51226 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that not only the return values match the expected results, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.
Follow-up to [51079], [51198].
See #52482, #52625, #53397.
git-svn-id: https://develop.svn.wordpress.org/trunk@51225 602fd350-edb4-49c9-b593-d223f7449a82
Fix a misnamed variable introduced in [51145]. Change `$query_args` to correctly defined variable `$query`.
Follow-up to [51145].
props desrosj, audrasjb.
Fixes#50105.
git-svn-id: https://develop.svn.wordpress.org/trunk@51224 602fd350-edb4-49c9-b593-d223f7449a82
r51211 accidentally introduced a fatal error for Multisite instances with `ms_files_rewriting` enabled. Reverting removes the error, and the original purpose of the commit can be solved in another way.
Props otto42, barry, ryelle, azaozz.
Fixes#53492. See #53475.
git-svn-id: https://develop.svn.wordpress.org/trunk@51223 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that not only the array values being compared are equal, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()`, `assertSameSets()`, or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable.
Follow-up to [40631], [41132], [48939], [51137].
See #52482, #52625.
git-svn-id: https://develop.svn.wordpress.org/trunk@51220 602fd350-edb4-49c9-b593-d223f7449a82
Removes temporary gutenberg_ functions which were required by the Legacy Widget
block until the Legacy Widget block was updated in [51149].
Follows [50996].
Fixes#53441.
Props spacedmonkey.
git-svn-id: https://develop.svn.wordpress.org/trunk@51219 602fd350-edb4-49c9-b593-d223f7449a82
The register_widget function can be called with a class name or a class
instance. Once called with a class instance, the class instance is converted to
hash as used key in array.
Props spacedmonkey, zieladam.
git-svn-id: https://develop.svn.wordpress.org/trunk@51216 602fd350-edb4-49c9-b593-d223f7449a82
This better aligns with developer expectations, as `add_theme_support()` and `remove_theme_support()` are meant to be called within functions attached to the `after_setup_theme` hook.
This also adds the `widgets-block-editor` feature to the docblock for `add_theme_support()`.
Props kevin940726, caseymilne, jamesros161, noisysocks, Mamaduka, audrasjb, zieladam, hellofromTonya, desrosj.
Fixes#53424.
git-svn-id: https://develop.svn.wordpress.org/trunk@51214 602fd350-edb4-49c9-b593-d223f7449a82
Incorrect variable names were leading to unreachable conditional statements.
Follow up to [51149].
Props johnbillion, mukesh27.
See #53458.
git-svn-id: https://develop.svn.wordpress.org/trunk@51213 602fd350-edb4-49c9-b593-d223f7449a82
In [51146], the `core-js` package replaced the deprecated `@babel//polyfill` one. The `core-js` package builds `wp-polyfill` from a configuration provided by `@wordpress/babel-preset-default` instead of copying a one size fits all polyfill.
That change caused an issue where plugins and themes relying on the `regenerator-runtime` script being included in the `wp-polyfill.js` file encountering fatal JavaScript errors.
This adds the `regenerator-runtime` package to Core and registers it as a dependency for `wp-polyfill`. While Core does not require `regenerator-runtime`, it will allow for a smoother transition to using `core-js`.
This dependency will be removed in a future version of WordPress, so developers are encouraged to add `regenerator-runtime` as a dependency for any custom script that requires it.
Follow up to [51146].
Props gziolo, herregroen, jeherve, hellofromtonya, peterwilsoncc.
Fixes#52941.
git-svn-id: https://develop.svn.wordpress.org/trunk@51212 602fd350-edb4-49c9-b593-d223f7449a82
The class has been heavily modified from the original source, so the copyright can be modified to simply reference the original author’s work. The carry forward of the copyright and original code is implied.
Follow up to [50993-50995,51007,51020,51029].
Props SergeyBiryukov, cbringmann, chanthaboune, desrosj.
Fixes#41683.
git-svn-id: https://develop.svn.wordpress.org/trunk@51210 602fd350-edb4-49c9-b593-d223f7449a82
Previously, full width blocks would cause a horizontal scrollbar, and nesting full width blocks would cause the content to be pulled off the screen. Now wide and full width blocks can be nested without any visual issues.
Props aleperez92, Boniu91, onemaggie, hellofromTonya.
Fixes#53428.
git-svn-id: https://develop.svn.wordpress.org/trunk@51209 602fd350-edb4-49c9-b593-d223f7449a82
Now that the pattern API request includes the locale and version, the cache key needs to contain a hash of the query args.
Props ocean90, dd32, timothyblynjacobs
Fixes#53435
git-svn-id: https://develop.svn.wordpress.org/trunk@51208 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds the `wp_filter_content_tags()` function as a filter to `widget_block_content`.
Props spacedmonkey, walbo, daisyo.
Fixes#53463, #53464.
git-svn-id: https://develop.svn.wordpress.org/trunk@51207 602fd350-edb4-49c9-b593-d223f7449a82
This information is needed by the w.org API for translation and caching.
Props dd32, ryelle, tellyworth
See #53435
git-svn-id: https://develop.svn.wordpress.org/trunk@51206 602fd350-edb4-49c9-b593-d223f7449a82
Fixes minor styling issues, mostly font size and spacing, in blocks used in widget areas. Changes made to Twenty Ten, Twenty Thirteen, Twenty Fourteen, Twenty Sixteen, Twenty Seventeen, and Twenty Twenty-One.
Props noisysocks, sumaiyasiddika, danieldudzic, scruffian, jffng.
Fixes#53422.
git-svn-id: https://develop.svn.wordpress.org/trunk@51205 602fd350-edb4-49c9-b593-d223f7449a82
This affects the `::walk()`, `::paged_walk()`, and `::get_number_of_root_elements()` methods.
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison
In particular, checking if an empty string is equal to zero in PHP 8 evaluates to `false`, not `true`.
For the `WP_Walker` class, this resulted in an incorrect handling of parent items in a few methods.
By explicitly checking for an `empty()` value instead, we make sure the check works as expected in PHP 8 and earlier versions.
Follow-up to [35876], [48960], [49043], [49076].
Props sunxiyuan, aristath, SergeyBiryukov.
Fixes#53474.
git-svn-id: https://develop.svn.wordpress.org/trunk@51204 602fd350-edb4-49c9-b593-d223f7449a82
The changes in [50959] introduced an issue where `custom_units` was always being coerced into a boolean value. This should support `array` values.
Props kraftner, youknowriad, nosolosw, jorgefilipecosta.
Fixes#53472.
git-svn-id: https://develop.svn.wordpress.org/trunk@51203 602fd350-edb4-49c9-b593-d223f7449a82
When using the text widget, a `wp.editor.initialize is not a function` notice is encountered. This happens when `wp-editor` is loaded as a dependency, which assigns `wp.oldEditor = wp.editor` and then redefines `wp.editor`.
`wp-editor` is only used for the Classic block, which is not supported in the new widgets editor. [51198-51199] updated `@wordpress/block-library` to remove `wp-editor` as a dependency, but it’s still listed as a dependency of the `wp-block-directory` script handle.
Since the Block directory is not supported within the widgets editor, the related assets can safely be blocked from enqueueing.
Props noisysocks, gziolo, Mamaduka, mkaz.
Fixes#53437. See #53397.
git-svn-id: https://develop.svn.wordpress.org/trunk@51202 602fd350-edb4-49c9-b593-d223f7449a82
This updates the widgets screen to load the editor styles in the same way as the post editor. This combined with the package updates in [51198] and [51199] ensures that the blocks added to sidebars more accurately reflect what will be displayed on the front end of the site.
Props isabel_brison, noisysocks, andraganescu, audrasjb, jorbin, caseymilne, desrosj.
Fixes#53344. See #53388.
git-svn-id: https://develop.svn.wordpress.org/trunk@51200 602fd350-edb4-49c9-b593-d223f7449a82
Account for sites enabling Gutenberg as an mu-plugin when determining whether full-site-editing themes can be enabled. This replaces the check the plugin is active with a check whether the function `gutenberg_is_fse_theme()` is defined.
Follow up to [51193].
Props noisysocks, peterwilsoncc, SergeyBiryukov.
See #53410.
git-svn-id: https://develop.svn.wordpress.org/trunk@51197 602fd350-edb4-49c9-b593-d223f7449a82
This allows smaller screens to wrap error messages and other uploader media item elements in a more readable way.
Props joedolson sabernhardt, Presskopp.
See #51754.
git-svn-id: https://develop.svn.wordpress.org/trunk@51195 602fd350-edb4-49c9-b593-d223f7449a82
After [51083], the Theme Details button is now displaying a border unintentionally. This removes it.
Props ryelle.
Fixes#53473.
git-svn-id: https://develop.svn.wordpress.org/trunk@51194 602fd350-edb4-49c9-b593-d223f7449a82
When a theme that uses the Full Site Editing feature is activated and the Gutenberg plugin is not present, the site will currently show a text notice on the front end. The user is not made aware of this unless they visit the front end of their site.
This adds a check that will prevent a theme from being activated when the `full-site-editing` tag is present in the theme’s `style.css` header and the Gutenberg plugin is not active to prevent this scenario.
These checks can be removed once Full Site Editing is completely merged into Core.
Props desrosj, marybaum, chanthaboune.
See #53410.
git-svn-id: https://develop.svn.wordpress.org/trunk@51193 602fd350-edb4-49c9-b593-d223f7449a82
This fixes an issue where Query Loop blocks were displayed with list bullets and extra `padding-left`.
Props AlePerez92, scruffian, ryelle.
Fixes#53438.
git-svn-id: https://develop.svn.wordpress.org/trunk@51192 602fd350-edb4-49c9-b593-d223f7449a82
Add handlers to increment the total attachments count for the media collection when an item is added or removed.
props adamsilverstein.
Fixes#53171.
git-svn-id: https://develop.svn.wordpress.org/trunk@51191 602fd350-edb4-49c9-b593-d223f7449a82
Restore inheriting the backbone fetch in the media library and adapt the AJAX response according to the action performed in the media query.
In [51145], the response shape was restored to the original shape, and a custom fetch was added to handle assigning the totalAttachments information in the collection. The custom fetch triggered a new set of bugs relating to zero-sized collections and loading individual images.
props adamsilverstein, ryelle, peterwilsoncc, Presskopp, desrosj.
Fixes#53421, #53419.
git-svn-id: https://develop.svn.wordpress.org/trunk@51187 602fd350-edb4-49c9-b593-d223f7449a82
Document the `$auto_update_settings` parameter of the `after_core_auto_updates_settings` action.
Follow-up to [49254].
See #52628.
git-svn-id: https://develop.svn.wordpress.org/trunk@51185 602fd350-edb4-49c9-b593-d223f7449a82
Synchronize the documentation between two places, use `WP_Site_Query::__construct()` as the canonical source.
Follow-up to [37616].
Props birgire, felipeelia, audrasjb.
Fixes#42156.
git-svn-id: https://develop.svn.wordpress.org/trunk@51184 602fd350-edb4-49c9-b593-d223f7449a82