-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Font Library: add wp_font_face post type and scaffold font face REST API controller #57656
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
Changes from 1 commit
11af824
3c2fc75
a3e494c
894f198
c0739dc
56823bc
88eb462
1de34f4
ee7a0b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,18 +35,17 @@ function gutenberg_init_font_library_routes() { | |
| register_post_type( | ||
| 'wp_font_face', | ||
| array( | ||
| 'labels' => array( | ||
| 'labels' => array( | ||
| 'name' => __( 'Font Faces', 'gutenberg' ), | ||
| 'singular_name' => __( 'Font Face', 'gutenberg' ), | ||
| ), | ||
| 'public' => false, | ||
| '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ | ||
| 'hierarchical' => false, | ||
| 'show_in_rest' => false, | ||
| 'rest_base' => 'font-faces', | ||
| 'public' => false, | ||
| '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ | ||
| 'hierarchical' => false, | ||
| 'show_in_rest' => false, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking of it this way: we don't want to manage the wp_font_face post type through the REST API, in the way that one usually would for post types that store user created content. From the perspective of the API consumer, posts for font faces and font families is more of an implementation detail. For example, none of the fields used in other post related endpoints ( This also matches how the Another problem is that a side effect of |
||
| 'rest_base' => 'font-faces', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This should have been used here. Not manaul registeration |
||
| // TODO: Add custom font capability | ||
| 'capability_type' => 'post', | ||
| 'capabilities' => array( | ||
| 'capabilities' => array( | ||
| 'read' => 'edit_theme_options', | ||
| 'read_post' => 'edit_theme_options', | ||
| 'read_private_posts' => 'edit_theme_options', | ||
|
|
@@ -61,8 +60,8 @@ function gutenberg_init_font_library_routes() { | |
| 'edit_others_posts' => 'edit_theme_options', | ||
| 'delete_others_posts' => 'edit_theme_options', | ||
| ), | ||
| 'map_meta_cap' => false, | ||
| 'query_var' => false, | ||
| 'map_meta_cap' => false, | ||
| 'query_var' => false, | ||
| ) | ||
| ); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the capabilities registered with the post type to check permissions here, so that creating font families in PHP will also be limited by the appropriate user caps.