diff --git a/src/classes/entities/class-tainacan-term.php b/src/classes/entities/class-tainacan-term.php
index 4e5a86dc7..9c0af5a39 100644
--- a/src/classes/entities/class-tainacan-term.php
+++ b/src/classes/entities/class-tainacan-term.php
@@ -45,6 +45,19 @@ class Term extends Entity {
return 'Hello, my name is '. $this->get_name();
}
+ public function __toArray(){
+ $term_array = parent::__toArray();
+
+ $term_id = $term_array['term_id'];
+
+ unset($term_array['term_id']);
+ unset($term_array['status']);
+
+ $term_array['id'] = $term_id;
+
+ return $term_array;
+ }
+
// Getters
/**
diff --git a/src/classes/field-types/category/AddNewTerm.vue b/src/classes/field-types/category/AddNewTerm.vue
index 057053854..9a6b34e54 100644
--- a/src/classes/field-types/category/AddNewTerm.vue
+++ b/src/classes/field-types/category/AddNewTerm.vue
@@ -28,7 +28,7 @@
@@ -94,19 +94,19 @@
instance.name = '';
instance.parent = 0;
- if( res.data && res.data.term_id || res.term_id ){
- let term_id = ( res.term_id ) ? res.term_id : res.data.term_id;
+ if( res.data && res.data.id || res.id ){
+ let id = ( res.id ) ? res.id : res.data.id;
let val = this.value;
if( !Array.isArray( val ) && this.field.field.multiple === 'no' ){
axios.patch(`/item/${this.item_id}/metadata/${this.field_id}`, {
- values: term_id,
+ values: id,
}).then(() => {
- instance.$emit('newTerm', term_id);
+ instance.$emit('newTerm', id);
})
} else {
val = ( val ) ? val : [];
- val.push( term_id );
+ val.push( id );
axios.patch(`/item/${this.item_id}/metadata/${this.field_id}`, {
values: val,
}).then( () => {
diff --git a/src/classes/field-types/category/Category.vue b/src/classes/field-types/category/Category.vue
index 1505e34d9..ca31567b8 100644
--- a/src/classes/field-types/category/Category.vue
+++ b/src/classes/field-types/category/Category.vue
@@ -99,7 +99,7 @@
term['level'] = level;
result.push( term );
const levelTerm = level + 1;
- const children = this.getOptions( term.term_id, levelTerm);
+ const children = this.getOptions( term.id, levelTerm);
result = result.concat( children );
}
}
@@ -110,8 +110,8 @@
let values = [];
if( this.value && this.value.length > 0){
for( let term of this.value ){
- if( term && term.term_id)
- values.push(term.term_id);
+ if( term && term.id)
+ values.push(term.id);
}
}
diff --git a/src/classes/field-types/category/CategoryCheckbox.vue b/src/classes/field-types/category/CategoryCheckbox.vue
index b81057ec6..74c18473d 100644
--- a/src/classes/field-types/category/CategoryCheckbox.vue
+++ b/src/classes/field-types/category/CategoryCheckbox.vue
@@ -9,7 +9,7 @@
:key="index"
v-model="checked"
@input="onChecked(option)"
- :native-value="option.term_id"
+ :native-value="option.id"
border>
{{ option.name }}
diff --git a/src/classes/field-types/category/CategoryRadio.vue b/src/classes/field-types/category/CategoryRadio.vue
index 3f35b852e..91c24a373 100644
--- a/src/classes/field-types/category/CategoryRadio.vue
+++ b/src/classes/field-types/category/CategoryRadio.vue
@@ -9,7 +9,7 @@
:key="index"
v-model="checked"
@input="onChecked(option)"
- :native-value="option.term_id"
+ :native-value="option.id"
border>
{{ option.name }}
diff --git a/src/classes/field-types/category/CategorySelectbox.vue b/src/classes/field-types/category/CategorySelectbox.vue
index de75c5b83..c2e1956fe 100644
--- a/src/classes/field-types/category/CategorySelectbox.vue
+++ b/src/classes/field-types/category/CategorySelectbox.vue
@@ -10,7 +10,7 @@
diff --git a/src/classes/field-types/category/CategoryTaginput.vue b/src/classes/field-types/category/CategoryTaginput.vue
index e4db4d565..42685e797 100644
--- a/src/classes/field-types/category/CategoryTaginput.vue
+++ b/src/classes/field-types/category/CategoryTaginput.vue
@@ -44,20 +44,20 @@
});
this.labels = [];
for( let term of result){
- this.labels.push({label: term.name, value: term.term_id})
+ this.labels.push({label: term.name, value: term.id})
}
}
},
selectedValues(){
if( this.value && this.value.length > 0 && this.selected.length === 0){
let result = this.terms.filter( ( item ) => {
- let id = item.term_id;
+ let id = item.id;
return ( this.value.indexOf( id ) >= 0 )
});
let selected = [];
for( let term of result){
- selected.push({label: term.name, value: term.term_id})
+ selected.push({label: term.name, value: term.id})
}
this.selected = selected;
}
diff --git a/src/languages/tainacan-pt_BR.po b/src/languages/tainacan-pt_BR.po
index 4699b9c50..82c15471a 100644
--- a/src/languages/tainacan-pt_BR.po
+++ b/src/languages/tainacan-pt_BR.po
@@ -792,8 +792,8 @@ msgstr ""
#: api/class-tainacan-rest-controller.php:501
msgid ""
-"Select taxonomy term by. Possible values are term_id, name, slug or "
-"term_taxonomy_id. Default value is term_id."
+"Select taxonomy term by. Possible values are id, name, slug or "
+"term_taxonomy_id. Default value is id."
msgstr ""
#: api/class-tainacan-rest-controller.php:505