mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-17 08:05:21 +01:00
748bb7d73a
Introduced in [56101] the `WP_Duotone` class, hooks into the `wp_loaded` action to load duotone style data from global styles. Hooking in early in the bootstrap process caused a number of problems. This hook, triggered an error on installing, as this lookup for global styles, would result in a global post trying to be created, even before the table existed. Additionally, this implementation caused a severe performance regression, as duotone styling data was loaded unnecessarily for requests that did not require such data, such as REST API calls or actions within the wp-admin interface. In this change, refactor the `WP_Duotone` to lazily load the global styles and theme.json data, only when a block that supports duotone is encountered. The method `render_duotone_support` was change to take a third parameter to reuse the existing `WP_Block_Type` object passed to the filter, to save it being looked up again. The code has also got improved type checking and the use of the util function `block_has_support`. Furthermore, the code's readability has been improved, along with enhancements to the documentation blocks. Props Chouby, spacedmonkey, SergeyBiryukov, swissspidy, costdev, joemcgill, flixos90, mukesh27, nazmul111, ajlende, isabel_brison. Fixes #58673. Built from https://develop.svn.wordpress.org/trunk@56226 git-svn-id: http://core.svn.wordpress.org/trunk@55738 1a063a9b-81f0-0310-95a4-ce76da25c4cd |
||
---|---|---|
.. | ||
align.php | ||
border.php | ||
colors.php | ||
custom-classname.php | ||
dimensions.php | ||
duotone.php | ||
elements.php | ||
generated-classname.php | ||
layout.php | ||
position.php | ||
settings.php | ||
shadow.php | ||
spacing.php | ||
typography.php | ||
utils.php |