Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Webfonts] Change architecture to use Core's Dependencies API #43492

Merged
merged 65 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0dd01bd
First pass at proof of concept extending `WP_Dependencies`.
desrosj Apr 25, 2022
60be65b
Keep the old file names to show an actual diff.
desrosj Apr 25, 2022
d3dfdf9
Move more methods into the new class.
desrosj Apr 25, 2022
ee531b1
Working on getting `do_item()` to work correctly.
desrosj Apr 25, 2022
3680ad2
Continuing to work on changing the underlying Webfont class.
desrosj Apr 25, 2022
db1487a
Simplify `add_dependency()` method.
desrosj Apr 26, 2022
8373081
Prep the unit tests
hellofromtonya Aug 18, 2022
6349401
wp_webfonts() plus tests
hellofromtonya Aug 18, 2022
fb5eb26
wp_register_font_family() plus tests
hellofromtonya Aug 18, 2022
5e2a3ed
wp_register_webfont_variation() plus tests
hellofromtonya Aug 18, 2022
43b13d6
wp_register_webfont() plus tests.
hellofromtonya Aug 19, 2022
b0cb503
wp_register_webfonts() plus tests
hellofromtonya Aug 19, 2022
abe2c87
wp_enqueue_webfont() plus tests
hellofromtonya Aug 19, 2022
69d0149
wp_enqueue_webfont_variations() plus tests
hellofromtonya Aug 24, 2022
dd0f4de
Updates register-webfonts-from-theme-json.php
hellofromtonya Aug 19, 2022
d409097
WP_Webfonts::dequeue()
hellofromtonya Aug 19, 2022
bdf141c
WP_Webfonts::get_enqueued() plus tests
hellofromtonya Aug 19, 2022
32939fd
WP_Webfonts::get_registered() plus tests
hellofromtonya Aug 19, 2022
bde64c0
wp_deregister_font_family() plus tests
hellofromtonya Aug 19, 2022
a083163
wp_deregister_webfont_variation() plus tests
hellofromtonya Aug 19, 2022
33d35d5
wp_get_webfont_providers() plus tests
hellofromtonya Aug 19, 2022
c75f21d
wp_print_webfonts() et al plus tests
hellofromtonya Aug 19, 2022
61725e1
wp_register_webfont_provider() plus tests
hellofromtonya Aug 23, 2022
1a83fc4
Add file and class docs to WP_Webfonts
hellofromtonya Aug 23, 2022
d7d3598
Deletes old WP_Webfonts file
hellofromtonya Aug 23, 2022
3ac8fea
More tests for wp_deregister_webfont_variation()
hellofromtonya Aug 24, 2022
e575e31
Adds temporary deprecated functionality.
hellofromtonya Aug 30, 2022
eb97c86
Turns on deprecations in multisite tests
hellofromtonya Aug 31, 2022
873ca61
Add tests for WP_Webfonts::dequeue()
hellofromtonya Aug 31, 2022
3ce6cec
Adds WP_Webfonts::query() tests
hellofromtonya Aug 31, 2022
750f730
Set font family done after printing
hellofromtonya Aug 31, 2022
cd873c9
Fix missing key PHP notices
hellofromtonya Sep 1, 2022
4607c6e
Explicitly define add() 2nd arg
Sep 1, 2022
96dc4c4
Simplify and encapsulate getting provider instance
hellofromtonya Sep 1, 2022
30c0053
Docs and performance: variation property defaults
hellofromtonya Sep 1, 2022
176eb29
Restore font family in variation required
hellofromtonya Sep 1, 2022
4e572a6
Add 'optional' to the list of supported values
aristath Oct 3, 2022
880302b
Separate style element from get_css()
hellofromtonya Dec 1, 2022
7417fc8
Allow for multiple style element attributes.
hellofromtonya Dec 1, 2022
637cdc8
method is public
aristath Dec 6, 2022
861b2b6
Update lib/experimental/webfonts.php
aristath Dec 6, 2022
2a91789
Update lib/experimental/webfonts.php
aristath Dec 6, 2022
f55940a
Update lib/experimental/webfonts.php
aristath Dec 6, 2022
abb0982
Update lib/experimental/class-wp-webfonts.php
aristath Dec 6, 2022
51a7906
Update lib/experimental/webfonts.php
aristath Dec 6, 2022
2937f7c
Update lib/experimental/class-wp-webfonts.php
aristath Dec 6, 2022
f497a97
Simplify condition - this is covered by is_defined already
aristath Dec 6, 2022
955ccfb
Simplify logic - isset() is the 1st check in add_font_family already
aristath Dec 6, 2022
62df827
improve inline doc
aristath Dec 6, 2022
edc5683
Revert f497a97. Add comment to explain
hellofromtonya Dec 8, 2022
1547a6b
Fix Tests_Webfonts_WpWebfonts_Enqueue::test_should_prequeue_when_not_…
hellofromtonya Dec 8, 2022
f8ae911
Fixes gutenberg_add_registered_webfonts_to_theme_json()
hellofromtonya Dec 13, 2022
4af3aaf
Reorganize class inheritance to group deprecations
hellofromtonya Dec 13, 2022
ca5fa4c
Simplify web font registration functions
hellofromtonya Dec 13, 2022
749a882
Update tests for new changes
hellofromtonya Dec 13, 2022
b42bba8
Add web fonts CSS to Site Editor iframe assets
hellofromtonya Dec 14, 2022
f6c541b
Make deprecated methods work
hellofromtonya Dec 14, 2022
15b075d
Removes or deprecates redundant global functions
hellofromtonya Dec 14, 2022
479cb69
Merge branch 'trunk' into try/rearchitect-webfonts-api
Dec 14, 2022
709d640
Removes duplicate from merge conflict resolution
Dec 14, 2022
230cf7c
Guard script-loader to prevent errors
hellofromtonya Dec 14, 2022
b0c2037
Removes "No web fonts are enqueued for printing"
hellofromtonya Dec 14, 2022
23dc407
Fix phpcs
hellofromtonya Dec 14, 2022
4ac7be0
Improve deprecations
hellofromtonya Dec 15, 2022
4259b97
Merge branch 'trunk' into try/rearchitect-webfonts-api
aristath Dec 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions lib/compat/wordpress-6.2/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,30 @@ function gutenberg_resolve_assets_override() {

$scripts = ob_get_clean();

/*
* Generate web font @font-face styles for the site editor iframe.
* Use the registered font families for printing.
*/
if ( class_exists( 'WP_Web_Fonts' ) ) {
$wp_webfonts = wp_webfonts();
$registered = $wp_webfonts->get_registered_font_families();
if ( ! empty( $registered ) ) {
$queue = $wp_webfonts->queue;
$done = $wp_webfonts->done;

$wp_webfonts->done = array();
$wp_webfonts->queue = $registered;

ob_start();
$wp_webfonts->do_items();
$styles .= ob_get_clean();

// Reset the Web Fonts API.
$wp_webfonts->done = $done;
$wp_webfonts->queue = $queue;
}
}

return array(
'styles' => $styles,
'scripts' => $scripts,
Expand Down
Loading