Changeset 43445 for branches/4.9/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
- Timestamp:
- 07/13/2018 06:50:51 AM (8 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
r43443 r43445 686 686 public function prepare_item_for_response( $item, $request ) { 687 687 688 $ schema = $this->get_item_schema();688 $fields = $this->get_fields_for_response( $request ); 689 689 $data = array(); 690 690 691 if ( ! empty( $schema['properties']['id']) ) {691 if ( in_array( 'id', $fields, true ) ) { 692 692 $data['id'] = (int) $item->term_id; 693 693 } 694 694 695 if ( ! empty( $schema['properties']['count']) ) {695 if ( in_array( 'count', $fields, true ) ) { 696 696 $data['count'] = (int) $item->count; 697 697 } 698 698 699 if ( ! empty( $schema['properties']['description']) ) {699 if ( in_array( 'description', $fields, true ) ) { 700 700 $data['description'] = $item->description; 701 701 } 702 702 703 if ( ! empty( $schema['properties']['link']) ) {703 if ( in_array( 'link', $fields, true ) ) { 704 704 $data['link'] = get_term_link( $item ); 705 705 } 706 706 707 if ( ! empty( $schema['properties']['name']) ) {707 if ( in_array( 'name', $fields, true ) ) { 708 708 $data['name'] = $item->name; 709 709 } 710 710 711 if ( ! empty( $schema['properties']['slug']) ) {711 if ( in_array( 'slug', $fields, true ) ) { 712 712 $data['slug'] = $item->slug; 713 713 } 714 714 715 if ( ! empty( $schema['properties']['taxonomy']) ) {715 if ( in_array( 'taxonomy', $fields, true ) ) { 716 716 $data['taxonomy'] = $item->taxonomy; 717 717 } 718 718 719 if ( ! empty( $schema['properties']['parent']) ) {719 if ( in_array( 'parent', $fields, true ) ) { 720 720 $data['parent'] = (int) $item->parent; 721 721 } 722 722 723 if ( ! empty( $schema['properties']['meta']) ) {723 if ( in_array( 'meta', $fields, true ) ) { 724 724 $data['meta'] = $this->meta->get_value( $item->term_id, $request ); 725 725 }
Note: See TracChangeset
for help on using the changeset viewer.