prabeen giri
prabeen giri

Reputation: 803

Create renderable nested tree array like Menu Tree or Taxonomy Tree

I am getting a nested array with children property from the WebSerice. I want to create the render able array so that I can use "drupal_render" function to render final HTML. I looked at the 'menu_tree_output' and 'taxonomy tree" that Drupal generates, but there is not proper documentation that mention how to structure the array to make it render able nested list.

Lets make it short: How do I restructure the final array that I get from Webservice so that I can make it renderable using drupal_render api. Final output is nested list(Folder tree).

Upvotes: 1

Views: 381

Answers (1)

halfzebra
halfzebra

Reputation: 6807

menu_tree_output is not intended for rendering anything else than menus.

You should use something like theme_item_list to render trees with your own data.

Here is an article explaining the usage of How to create custom item list in Drupal 7 that theme function.

I would define my own custom theme_item_list__something, based on the native one, for full controll over markup.

Upvotes: 1

Related Questions