- Timestamp:
- 05/02/2018 01:24:30 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
r42354 r43087 692 692 public function prepare_item_for_response( $item, $request ) { 693 693 694 $ schema = $this->get_item_schema();694 $fields = $this->get_fields_for_response( $request ); 695 695 $data = array(); 696 696 697 if ( ! empty( $schema['properties']['id']) ) {697 if ( in_array( 'id', $fields, true ) ) { 698 698 $data['id'] = (int) $item->term_id; 699 699 } 700 700 701 if ( ! empty( $schema['properties']['count']) ) {701 if ( in_array( 'count', $fields, true ) ) { 702 702 $data['count'] = (int) $item->count; 703 703 } 704 704 705 if ( ! empty( $schema['properties']['description']) ) {705 if ( in_array( 'description', $fields, true ) ) { 706 706 $data['description'] = $item->description; 707 707 } 708 708 709 if ( ! empty( $schema['properties']['link']) ) {709 if ( in_array( 'link', $fields, true ) ) { 710 710 $data['link'] = get_term_link( $item ); 711 711 } 712 712 713 if ( ! empty( $schema['properties']['name']) ) {713 if ( in_array( 'name', $fields, true ) ) { 714 714 $data['name'] = $item->name; 715 715 } 716 716 717 if ( ! empty( $schema['properties']['slug']) ) {717 if ( in_array( 'slug', $fields, true ) ) { 718 718 $data['slug'] = $item->slug; 719 719 } 720 720 721 if ( ! empty( $schema['properties']['taxonomy']) ) {721 if ( in_array( 'taxonomy', $fields, true ) ) { 722 722 $data['taxonomy'] = $item->taxonomy; 723 723 } 724 724 725 if ( ! empty( $schema['properties']['parent']) ) {725 if ( in_array( 'parent', $fields, true ) ) { 726 726 $data['parent'] = (int) $item->parent; 727 727 } 728 728 729 if ( ! empty( $schema['properties']['meta']) ) {729 if ( in_array( 'meta', $fields, true ) ) { 730 730 $data['meta'] = $this->meta->get_value( $item->term_id, $request ); 731 731 }
Note: See TracChangeset
for help on using the changeset viewer.