From 243fc158e65b43f1934909867823a73744ab901a Mon Sep 17 00:00:00 2001 From: eduardohumberto Date: Thu, 30 Aug 2018 22:03:08 -0300 Subject: [PATCH] remove notices in facets endpoint (ref. #94) --- src/admin/components/other/checkbox-filter-modal.vue | 2 +- .../class-tainacan-rest-facets-controller.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/admin/components/other/checkbox-filter-modal.vue b/src/admin/components/other/checkbox-filter-modal.vue index cc3188319..f56d3cbbb 100644 --- a/src/admin/components/other/checkbox-filter-modal.vue +++ b/src/admin/components/other/checkbox-filter-modal.vue @@ -453,7 +453,7 @@ let valueIndex = this.finderColumns[i].findIndex(option => option.value == selected); if (valueIndex >= 0) { - onlyLabels.push(this.finderColumns[i][valueIndex].name); + onlyLabels.push(this.finderColumns[i][valueIndex].label); } } } diff --git a/src/api/endpoints/class-tainacan-rest-facets-controller.php b/src/api/endpoints/class-tainacan-rest-facets-controller.php index 35eae8fd8..a320623b9 100644 --- a/src/api/endpoints/class-tainacan-rest-facets-controller.php +++ b/src/api/endpoints/class-tainacan-rest-facets-controller.php @@ -198,12 +198,12 @@ class REST_Facets_Controller extends REST_Controller { $row = [ 'label' => $item['name'], 'value' => $item['id'], - 'img' => $item['header_image'], - 'parent' => $item['parent'], - 'total_children' => $item['total_children'], + 'img' => ( isset($item['header_image']) ) ? $item['header_image'] : false , + 'parent' => ( isset($item['parent']) ) ? $item['parent'] : 0, + 'total_children' => ( isset($item['total_children']) ) ? $item['total_children'] : 0, 'type' => 'Taxonomy', 'taxonomy_id' => $this->taxonomy->WP_Post->ID, - 'taxonomy' => $item['taxonomy'], + 'taxonomy' => ( isset($item['taxonomy']) ) ? $item['taxonomy'] : false, ]; } else if( $type === 'Tainacan\Metadata_Types\Relationship' ){ @@ -211,7 +211,7 @@ class REST_Facets_Controller extends REST_Controller { $row = [ 'label' => $item['title'], 'value' => $item['id'], - 'img' => $item['thumbnail']['thumb'], + 'img' => ( isset($item['thumbnail']['thumb']) ) ? $item['thumbnail']['thumb'] : false, 'parent' => false, 'total_children' => 0, 'type' => 'Relationship'