`_wp_array_get()` is an expensive function, and it's called thousands of times on each page view on the front end. While the function performance was slightly improved in #58376, it is still called more times than it should be.
This commit aims to further optimize its usage:
* In many cases, `_wp_array_get()` can be replaced with a much simpler and faster `isset()` check.
* The `isset()` function is capable of checking nested arrays, so `isset( $foo['a']['b']['c'] )` will return false even if `$foo['a']` is unset, without throwing any errors or warnings.
* When `_wp_array_get()` cannot be directly replaced with `isset()`, it would be good practice to wrap it in an `isset()` function so that `_wp_array_get()` only runs when it needs to.
Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/51116#51116 Performance improvement: Reduce the use of the _wp_array_get() function]
Follow-up to [55851], [56382].
Props aristath, jrf, spacedmonkey, mukesh27, swissspidy, hellofromTonya.
Fixes#59405.
Built from https://develop.svn.wordpress.org/trunk@56709
git-svn-id: http://core.svn.wordpress.org/trunk@56221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Most block feature checks are for a single feature string, and for such cases it is not intuitive to require an array for the `$feature` parameter of the `block_has_support()` function.
This changeset brings it in line with other functions like `post_type_supports()`, allowing to pass a string for the `$feature`. An array is still supported for more complex cases where support for sub-features needs to be determined. This change furthermore includes a very minor performance tweak by avoiding calls to the `_wp_array_get()` function if a single feature string is being checked for.
Props thekt12, nihar007, mukesh27, swissspidy.
Fixes#58532.
Built from https://develop.svn.wordpress.org/trunk@56382
git-svn-id: http://core.svn.wordpress.org/trunk@55894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds the new dimension feature's PHP code for supporting minimum height in the block editor inspector and in global styles. Minimum height is quite useful for defining the minimum vertical dimensions of a block, while allowing it to expand beyond that size.
In this changeset:
* Adds support in `theme.json`.
* Adds support in the style engine.
* Adds support in `wp_apply_dimensions_support()`.
* Renames the setting from `'__experimentalDimensions'` to `dimensions` in `wp_register_dimensions_support()`.
* Adds PHPUnit tests.
Is renaming `'__experimentalDimensions'` a backwards-compatibility (BC) break?
Though the setting has been in the code since 5.9.0, it was never wired to anything, ie it did not expose any controls or styles. Notice in `wp_register_dimensions_support()` and `wp_apply_dimensions_support()` prior to this changeset, there are inline comments as placeholders for height and width support, but no code.
If a developer opted in to use it, it had no effect.
A search in wp.org's plugin and themes repo showed no instances of this experimental setting.
Given there was no functionality attached to it (until this changeset), no change in behavior or effect from removing it, and no usage found in the plugins and themes repository, it does appear to be a BC break.
References:
* [https://github.com/WordPress/gutenberg/pull/45300 Gutenberg PR 45300]
* [https://github.com/WordPress/gutenberg/pull/45334 Gutenberg PR 45334]
Follow-up to [53076], [52069].
Props andrewserong, aaronrobertshaw , costdev, hellofromTonya, isabel_brison, joen, paaljoachim, mukesh27, ntsekouras, oandregal, ramonopoly.
Fixes#57582.
Built from https://develop.svn.wordpress.org/trunk@55175
git-svn-id: http://core.svn.wordpress.org/trunk@54708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Migrate spacing, border, color, dimensions, elements and typography and associated tests for block supports in the block editor.
Related changes in Gutenberg:
- Include individual serialization changes from 6de16981c7
- Skip Style Engine integration from 44925a947f%60
Props ramonopoly, aaronrobertshaw.
See #55505.
Built from https://develop.svn.wordpress.org/trunk@53076
git-svn-id: http://core.svn.wordpress.org/trunk@52665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- 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.
Built from https://develop.svn.wordpress.org/trunk@52069
git-svn-id: http://core.svn.wordpress.org/trunk@51661 1a063a9b-81f0-0310-95a4-ce76da25c4cd