Hi In Ubercart's uc_catalog module it has the functionality you need. Perhaps that could be adapted into a new feature/api function for the core taxonomy module? Lee On Sat, 2011-10-15 at 14:37 -0400, Liam McDermott wrote:
Hello list,
First: I know this list is rarely used for core development any more, so if there's a better place for this, let me know!
What I'm trying to do: patch core to make forum-list.tpl.php output an unordered list. To be semantically correct, sub-forums need to be nested instead of that ghastly <div class="indent"> we currently use on the forum front page.
The problem with doing this is taxonomy_get_tree() returns a flat array, making it much harder to create a nested list than if it returned a multi-dimensional array, where child terms are nested beneath their parents. For example, instead of returning:
array( [0] => stdClass::__set_state(array( 'name' => 'Child item', // Class containing child tax. term's information. parents => array( 0 => '1', ), )), [1] => stdClass::__set_state(array( 'name' => 'Parent item', // Class containing parent tax. term's information. parents => array( 0 => '0', ), )), );
It would be ideal if taxonomy_get_tree() returned something like:
array( [0] => array( 'name' => 'Parent item', // Array containing parent tax. term's information. [0] => array( 'name' => 'Child item', // Array containing child tax. term's information. ), ), );
Alternatively the array of taxonomy terms could be changed, after the fact, in template_preprocess_forum_list() but that seems like a kludge. Surely taxonomy_get_tree() should just be outputting the correct thing in the first place?
Hope this makes sense and I'd love to get some idea of how to proceed!
Kind Regards, Liam McDermott.