-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
wp_font_face
post type is a near duplication of the attachment
post type.
#59387
Comments
I believe this has been considered initially and the decision was made to not go with attachments. Maybe @matiasbenedetto recall the context here. By looking at the code, here are some of the main differences:
I agree that ultimately "attachments" can be seen as a file abstraction but the differences above seem to be meaningful. It feels like if the decision in #55280 is to stick with. |
I'd like to share a discussion @matiasbenedetto @youknowriad and I had last June. Riad asked whether "attachments" fit into the Font Library. I didn't see font files or the Font Library as a use-case for these reasons:
|
Yes, I agree with @youknowriad: there is an argument to be made for "attachments..as a file abstraction". However, as Riad and I both shared, there are distinct differences between the font files and media attachments, as well as Media Library and Font Library. Fast-forward to today's design. A near duplication is cause for pause (rhyme unintended 😉 ). It suggests attachments could have been potentially used as the base abstraction and then the distinct font needs built on top of it. I'm wondering about these bigger questions as we consider this discussion and what should happen next:
Please note, I fully support @peterwilsoncc raising these concerns, support this discussion, and support design decisions being revisited. This feature has not yet shipped. We can't fast travel back to last summer to reconsider its architectural needs and design. Rather, the best we can do today is to revisit and discuss to determine if it is the right design for the feature, contributors, extenders, and the long-term (especially within the reality of big picture burden). |
Some differences between
|
I think @youknowriad's analysis is spot on. Attachments and Fonts feel different enough that reusing the same post type feels like a mistake. To me, this more signifies we need better ways to have shared commonalities between post types. Perhaps we should explore (in a separate issue) abstract post types or something like PHP traits for post types? |
Thanks for chiming in folks. I agree, it appears there are enough differences to justify the near duplicate. @creativecoder raises a great point about multiple source files that I hadn’t considered. I’m happy if this is closed as unplanned |
Description
The Font Library feature introduces two new post types:
wp_font_family
for the general font name (eg, Open Sans, Noto Sans, etc) andwp_font_face
for the storage in the individual font files (eg, Open Sans Regular, Bold, etc).The font-face typically includes:
Each of these components is either directly or computationally available via the existing
attachment
post type.Adding a near duplicate post type causes a number of issues (some of which have been hit already):
The duplication of hooks is of major concern to me as core contributors will need to rapidly iterate 20 years of allowances for theme and plugin developers to allow them to customize file systems for attachments.
While there are plans to allow font files to be hosted on CDNs, I think the fundamental issues with near duplication of existing code remains and will continue in to the future.
I think the use of a new post type needs to be reconsidered due to the maintenance burdon it will create for contributors: both in the near term playing catch up with hooks and the future as changes need to be duplicated for each post type.
Step-by-step reproduction instructions
N/A
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: