Due to 'Hierarchical Term Formatter ' causing issue with existing information here'sThe following code takes the solution I usedabsolute child tid and grabs all parents.
to make a template override.
explode $output into array .
I know that I will only have 4 maximum values here The second argument is for the amount of terms you wish to return; and the thrid for how you want to order it.
use a foreach statment that iterates through these values and makes another array with Parent name and tid data attached
$result =/**
db_query('SELECT* ttd.name,@file tth.parent,Orders ttd.tidTaxonomy
*
FROM* {taxonomy_term_data}@param ttd$output LEFT- JOINexpecting {taxonomy_term_hierarchy}a tthtid ON ttd.tid// =check tth.tidthis at WHEREthe ttd.namepoint =of :locationrunning ',the array(':location' => $location_trimmed));
function
* @param $no_results if- ($resultthe !=number NULL)of {results that you'd like to return
* @param $order - which tid first - child or most foreachsenior parent ?
*/
function taxonomy_order($result$output, as$no_results $record= 1, $order = 'first') {
$terms = entity_load('taxonomy_term', array($output));
$wrapper = entity_metadata_wrapper('taxonomy_term', $output);
$locations[$key]['parent']$all_parents = $record$wrapper->parent;>parents_all->value();
( $order == 'last' ) ? $all_parents = array_reverse($all_parents) : $all_parents;
$locations[$key]['location_name']$stitch_term_array = $record->name;'';
foreach ($all_parents as $key => $term) {
($key < $no_results ) ? $locations[$key]['location_tid']$stitch_term_array .= $record$term->tid;
>name . ", " : '';
}
$stitch_term_array = }rtrim($stitch_term_array, ', ');
return $stitch_term_array;
Then I've written some conditional statements to put them in order , using
array_push,array_unshift & array_splice .