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

Update Font Library non-REST API code to align with Core standards #58607

Merged

Conversation

getdave
Copy link
Contributor

@getdave getdave commented Feb 2, 2024

What?

Aligns the Font Library code with Core PHP standards.

See #55277 (comment)

Co-authored-by: getdave get_dave@git.wordpress.org
Co-authored-by: anton-vlasenko antonvlasenko@git.wordpress.org
Co-authored-by: hellofromtonya hellofromtonya@git.wordpress.org
Co-authored-by: pbking pbking@git.wordpress.org

⚠️ Questions

  • Do we want wp_unregister_font_collection to provide a return value because currently it doesn't.
  • google-fonts-to-wordpress-collection has a TODO to update to "production font collection":
    • will we do this at point of merge? If not we should provide a more detailed comment.
    • a build process for this can be handled after the initial Core merge.
    • should we make this into a constant?

Why?

How?

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

Copy link

github-actions bot commented Feb 2, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core SVN

If you're a Core Committer, use this list when committing to wordpress-develop in SVN:

Props: antonvlasenko, get_dave, hellofromtonya, mmaattiiaass, pbking.

GitHub Merge commits

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: anton@antons-mac-mini.local.

Co-authored-by: anton-vlasenko <antonvlasenko@git.wordpress.org>
Co-authored-by: getdave <get_dave@git.wordpress.org>
Co-authored-by: hellofromtonya <hellofromtonya@git.wordpress.org>
Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org>
Co-authored-by: pbking <pbking@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

github-actions bot commented Feb 2, 2024

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php
❔ lib/compat/wordpress-6.5/fonts/class-wp-font-library.php
❔ lib/compat/wordpress-6.5/fonts/class-wp-font-utils.php
❔ lib/compat/wordpress-6.5/fonts/fonts.php

* @return array Modified upload directory.
* @return array Modified allowed mime types.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this was incorrect but flagging just in case.

@getdave
Copy link
Contributor Author

getdave commented Feb 2, 2024

I'm going to try and rebase this now.

@getdave getdave force-pushed the update/font-library-core-code-for-standards-alignment branch from b84483e to 12e969d Compare February 2, 2024 14:21
@getdave getdave marked this pull request as ready for review February 2, 2024 14:21
@anton-vlasenko
Copy link
Contributor

I'm going to try and rebase this now.

Thanks. I will abstain from committing code for now.

@pbking
Copy link
Contributor

pbking commented Feb 2, 2024

Do we want wp_unregister_font_collection to provide a return value because currently it doesn't.

Yes, I believe it should return the response of unregister_font_collection

@getdave
Copy link
Contributor Author

getdave commented Feb 2, 2024

Yes, I believe it should return the response of unregister_font_collection

✅ in 4373d07

@getdave
Copy link
Contributor Author

getdave commented Feb 2, 2024

@pbking Are you able to advise on the Google fonts collection URL?

@matiasbenedetto
Copy link
Contributor

@pbking Are you able to advise on the Google fonts collection URL?

@getdave I think this thread can have the answer to this:
#58530 (comment)

anton-vlasenko added a commit that referenced this pull request Feb 2, 2024
@anton-vlasenko anton-vlasenko force-pushed the update/font-library-core-code-for-standards-alignment branch from 12f980a to d16d226 Compare February 2, 2024 20:07
@getdave
Copy link
Contributor Author

getdave commented Feb 2, 2024

@anton-vlasenko Are we in a good place to merge this now?

@anton-vlasenko
Copy link
Contributor

@anton-vlasenko Are we in a good place to merge this now?

@getdave
No, something strange happened to my working copy.
I think I need 30 minutes to double check everything.
I will ping you when it's ready.

Copy link

github-actions bot commented Feb 2, 2024

Flaky tests detected in ac52e89.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7761362749
📝 Reported issues:

@anton-vlasenko
Copy link
Contributor

anton-vlasenko commented Feb 2, 2024

@getdave, I think it's good to go. Just not sure where this bit in the fonts.php file came from, but it looks like we should keep it:

function gutenberg_init_font_library() {
	gutenberg_create_initial_post_types();
	gutenberg_create_initial_rest_routes();
}

There were tons of changes in the trunk, so I had to start this PR from scratch.

matiasbenedetto pushed a commit that referenced this pull request Feb 2, 2024
* Remove empty line after @return

* Fix comment format

* Applying fixes from #58607

* Improve readability.

---------

Co-authored-by: Anton Vlasenko <vlasenko.anton@gmail.com>
Co-authored-by: getdave <get_dave@git.wordpress.org>
Co-authored-by: anton-vlasenko <antonvlasenko@git.wordpress.org>
Co-authored-by: pbking <pbking@git.wordpress.org>
Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org>
@matiasbenedetto
Copy link
Contributor

Just not sure where this bit in the fonts.php file came from, but it looks like we should keep it:

@anton-vlasenko it seems valid. It's not adding anything new, just calling some parts of the code differently. It seems like added recently vs what's in trunk. In both cases (trunk and this branch) the code invoked is working fine. It's safe to add.

Copy link
Contributor

@matiasbenedetto matiasbenedetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the enhancements. The changes look good to me.

@matiasbenedetto matiasbenedetto merged commit 408c118 into trunk Feb 2, 2024
57 checks passed
@matiasbenedetto matiasbenedetto deleted the update/font-library-core-code-for-standards-alignment branch February 2, 2024 22:42
@github-actions github-actions bot added this to the Gutenberg 17.7 milestone Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Font Library [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants