Skip to content

Commit

Permalink
Fixed grabbing other fields for taxonomy terms and removed debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Dewhurst committed Jun 9, 2020
1 parent cdfe159 commit 91adf9f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,25 +418,25 @@ public function get_taxonomy_terms(\Twig\Environment $env, array $context, $taxo
];

if ($values['parent'] === "0") {
$taxonomy_array[$values['tid']] = $values;
$taxonomy_array[$tid] = $values;
}
else {
$taxonomy_array[$values['parent']]['children'][$values['tid']] = $values;
$taxonomy_array[$values['parent']]['children'][$tid] = $values;
}

// Add extra fields if supplied.
if (!is_null($other_fields)) {
foreach ($other_fields as $field) {
$taxonomy_array[$i][$field] = $term->get($field)[0]->value;
if ($values['parent'] === "0") {
$taxonomy_array[$tid][$field] = $term->get($field)[0]->value;
}
else {
$taxonomy_array[$values['parent']]['children'][$tid][$field] = $term->get($field)[0]->value;
}
}
}

$i++;
}

dump($taxonomy_array);
exit;

return $taxonomy_array;
}

Expand Down

0 comments on commit 91adf9f

Please sign in to comment.