How can I make a Menu Block not auto-expand the current page's menu links? I want my menu block to decide whether to show link children based only on whether the menu link (or the entire menu block) is set to "Expanded", not whether you're currently on the same page as the link that has children. What's the best way to do this?
I'm currently doing this with hook_menu_block_alter() calling itself recursively:

function THEME_NAME_menu_block_tree_alter(&amp;$tree, &amp;$config) {
    if($config['expanded']) {
        return;
    }

    foreach($tree as $link_key =&gt; &amp;$link) {
        if(!empty($link['below'])) {
            if(!$link['link']['expanded']) {
                $link['below'] = array();
            } else {
                THEME_NAME_menu_block_tree_alter($link['below'], $config);
            }
        }
    }

    unset($link);
}


But this feels super sketchy and I'm not at all confident that it's the best solution. I could break the foreach() into a separate recursive function, but that hardly seems different, other than my general icky feeling which I'm not sure there's even a logical reason for me to have.