-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Backport: Block template utils and rest templates controller #3221
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
e690417
a416a0a
f1958f4
0ae99e1
09ec609
1bf24b4
adb4dca
d4a2bb8
c63eb7d
06c0082
942ef32
2bdd393
2dcfe25
d0c2010
33a4eba
4ef9146
5deea6b
5ba2daf
0d2d57c
4b32c15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
icon to types controller
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,6 +221,10 @@ public function prepare_item_for_response( $item, $request ) { | |
| $data['slug'] = $post_type->name; | ||
| } | ||
|
|
||
| if ( in_array( 'icon', $fields, true ) ) { | ||
| $data['icon'] = $post_type->menu_icon; | ||
|
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. If this value is null, should it maybe default to something?
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 think it's okay to be null since it's not required and the consumers can decide what to do with it. For example in php core for post types we assign some default icon if it's in the |
||
| } | ||
|
|
||
| if ( in_array( 'supports', $fields, true ) ) { | ||
| $data['supports'] = $supports; | ||
| } | ||
|
|
@@ -287,6 +291,7 @@ protected function prepare_links( $post_type ) { | |
| * @since 4.7.0 | ||
| * @since 4.8.0 The `supports` property was added. | ||
| * @since 5.9.0 The `visibility` and `rest_namespace` properties were added. | ||
| * @since 6.1.0 The `icon` property was added. | ||
| * | ||
| * @return array Item schema data. | ||
| */ | ||
|
|
@@ -385,6 +390,12 @@ public function get_item_schema() { | |
| ), | ||
| ), | ||
| ), | ||
| 'icon' => array( | ||
| 'description' => __( 'The icon for the post type.' ), | ||
| 'type' => 'string', | ||
ntsekouras marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 'context' => array( 'view', 'edit', 'embed' ), | ||
|
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. Does this need to be in the view context? The icon is not public right now?
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. What do you mean public? I think it would be good to have in
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. If you make a property as view it means it can't be viewed pubilically. Do we want to expose this data publically?
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 see no harm in it, but if you have a strong opinion on this, I can remove it. |
||
| 'readonly' => true, | ||
| ), | ||
| ), | ||
| ); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.