I'm creating a custom module block that will sit in the sidebar on certain levels of my site template.

The site structure is: Home > Level 1 > Level 2 > Article.

I want Level 2 to echo out all of the child links (basically a menu tree).

I want to achieve this with hook_block_view(). How can I get the page's child links in the main menu, and put them in an array?


1 Answer 1


Have you tried using Menu Block?

provides configurable blocks of menu trees starting with any level of any menu.

It does exactly what you're looking for. If you still want to write a custom module I reckon looking through the code for that module would be the best place to start.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.