[development] Should taxonomy_get_tree() return a structured array?
Liam McDermott
lists at intermedia-online.com
Sat Oct 15 18:37:29 UTC 2011
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.
More information about the development
mailing list