Commit 269e90f3d7ae9c2cdd2167723fce86966a1017c1
1 parent
7399133500
Exists in
master
coba parents
Showing 1 changed file with 24 additions and 0 deletions Side-by-side Diff
sinkronisasi.include.php
... | ... | @@ -21,6 +21,11 @@ function sinkronisasi_export_iterate($terms) { |
21 | 21 | foreach ($terms as $tid => $term) { |
22 | 22 | $terms[$tid] = sinkronisasi_taxonomy_term_denormalization($term); |
23 | 23 | |
24 | + parents = taxonomy_term_get_parents($tid); | |
25 | + if (!empty($parents)) { | |
26 | + var_dump($parents); die; | |
27 | + } | |
28 | + | |
24 | 29 | unset($terms[$tid]->rdf_mapping); |
25 | 30 | } |
26 | 31 | return $terms; |
... | ... | @@ -117,6 +122,25 @@ function sinkronisasi_import_iterate($terms) { |
117 | 122 | } |
118 | 123 | } |
119 | 124 | |
125 | +function sinkronisasi_get_term_by_field_original_tid($tid) { | |
126 | + $entity_type = "taxonomy_term"; | |
127 | + | |
128 | + $query = new EntityFieldQuery(); | |
129 | + $query->entityCondition('entity_type', $entity_type); | |
130 | + $query->fieldCondition('field_original_tid', 'value', $tid); | |
131 | + | |
132 | + $result = $query->execute(); | |
133 | + if (!$result) { | |
134 | + return; | |
135 | + } | |
136 | + | |
137 | + $tids = array_keys($result[$entity_type]); | |
138 | + $terms = taxonomy_term_load_multiple($tids); | |
139 | + | |
140 | + $term = array_shift($terms); | |
141 | + return $term; | |
142 | +} | |
143 | + | |
120 | 144 | function sinkronisasi_set_field_original_tid($term) { |
121 | 145 | $term->field_original_tid['und'][0]['value'] = $term->tid; |
122 | 146 | return $term; |