Changeset 54269 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
- Timestamp:
- 09/20/2022 09:19:10 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r53760 r54269 187 187 $data = array(); 188 188 189 if ( in_array( 'capabilities', $fields, true) ) {189 if ( rest_is_field_included( 'capabilities', $fields ) ) { 190 190 $data['capabilities'] = $post_type->cap; 191 191 } 192 192 193 if ( in_array( 'description', $fields, true) ) {193 if ( rest_is_field_included( 'description', $fields ) ) { 194 194 $data['description'] = $post_type->description; 195 195 } 196 196 197 if ( in_array( 'hierarchical', $fields, true) ) {197 if ( rest_is_field_included( 'hierarchical', $fields ) ) { 198 198 $data['hierarchical'] = $post_type->hierarchical; 199 199 } 200 200 201 if ( in_array( 'visibility', $fields, true) ) {201 if ( rest_is_field_included( 'visibility', $fields ) ) { 202 202 $data['visibility'] = array( 203 203 'show_in_nav_menus' => (bool) $post_type->show_in_nav_menus, … … 206 206 } 207 207 208 if ( in_array( 'viewable', $fields, true) ) {208 if ( rest_is_field_included( 'viewable', $fields ) ) { 209 209 $data['viewable'] = is_post_type_viewable( $post_type ); 210 210 } 211 211 212 if ( in_array( 'labels', $fields, true) ) {212 if ( rest_is_field_included( 'labels', $fields ) ) { 213 213 $data['labels'] = $post_type->labels; 214 214 } 215 215 216 if ( in_array( 'name', $fields, true) ) {216 if ( rest_is_field_included( 'name', $fields ) ) { 217 217 $data['name'] = $post_type->label; 218 218 } 219 219 220 if ( in_array( 'slug', $fields, true) ) {220 if ( rest_is_field_included( 'slug', $fields ) ) { 221 221 $data['slug'] = $post_type->name; 222 222 } 223 223 224 if ( in_array( 'supports', $fields, true ) ) { 224 if ( rest_is_field_included( 'icon', $fields ) ) { 225 $data['icon'] = $post_type->menu_icon; 226 } 227 228 if ( rest_is_field_included( 'supports', $fields ) ) { 225 229 $data['supports'] = $supports; 226 230 } 227 231 228 if ( in_array( 'taxonomies', $fields, true) ) {232 if ( rest_is_field_included( 'taxonomies', $fields ) ) { 229 233 $data['taxonomies'] = array_values( $taxonomies ); 230 234 } 231 235 232 if ( in_array( 'rest_base', $fields, true) ) {236 if ( rest_is_field_included( 'rest_base', $fields ) ) { 233 237 $data['rest_base'] = $base; 234 238 } 235 239 236 if ( in_array( 'rest_namespace', $fields, true) ) {240 if ( rest_is_field_included( 'rest_namespace', $fields ) ) { 237 241 $data['rest_namespace'] = $namespace; 238 242 } … … 288 292 * @since 4.8.0 The `supports` property was added. 289 293 * @since 5.9.0 The `visibility` and `rest_namespace` properties were added. 294 * @since 6.1.0 The `icon` property was added. 290 295 * 291 296 * @return array Item schema data. … … 386 391 ), 387 392 ), 393 'icon' => array( 394 'description' => __( 'The icon for the post type.' ), 395 'type' => array( 'string', 'null' ), 396 'context' => array( 'view', 'edit', 'embed' ), 397 'readonly' => true, 398 ), 388 399 ), 389 400 );
Note: See TracChangeset
for help on using the changeset viewer.