Change Widget Default view to Flat

This is kind of a two in one, but hopefully solving the default flat view will also solve my other issue. Here’s the details.

I am making my own widget. It basically pulls the actions, just like the Actions->Pages widget. But what my end goal is to have this widget only display actions for a specific directory. So I’m filtering it by the URL, but this is causing an issue because in the default expanded view, the full url is not shown. It only shows the specific name of the current page/directory that it is in. When you choose to flatten the widget, it displays the full URL.

The main answer I am seeking with this post is, how do I make my widget default to the Flat view? I have tried playing with the section in the Controller.php where is checks if flat is true or false, but all that does is tells the menu in the footer cog whether to show flatten or hierarchical. I have messed around with code all over the place trying to set the variable $expanded to true, then tried false. Then tried changing that variable to $flat and set it to true, then false. Then set it to 1, and 0. I’m just shooting in the dark now, trying anything that might possibly work.

My hope is, if I can get it to default to flat (which I need it to do whether it fixes my other problem or not), is that the filter using the URL will actually work then. If not, then I suppose that would be my next task/question.

Any help is much appreciated! If I missed somewhere that discusses this please direct me there. I tried doing an extensive search before posting this but didn’t see anything that answered my question.


$view->requestConfig->flat = true;