Extending Fuel_base_controller with custom left_sidebar nav sorting
Hey there,
i'm new to FuelCMS but already in love. It's a great project and it's amazing you open-sourced it. Too bad there isn't an in-depth tutorial on creating advanced modules, i'm having a hard time figuring it all out alone...
Anyway, here's one question for you.
What i'm after: to be able to change the order in which the "modules" are sorted in the admin navigation sidebar.
Why: because i'd love to find my newly created advanced module before the Blog one, and not after everything else.
How i did it: I've basically added a method to the Fuel_base_controller called _nav_sort and added a config item in the fuel module config file that contains the module order (an array like : 'site', 'blog', 'module_1', 'module_2' etc)
But i'm 100% sure i'm doing it wrong. The thing is, can i "extend" or override the _nav() method of the Fuel_base_controller without hacking it?
Thanks a lot, you rock.
Comments
$config['nav']['site'] = array(
'dashboard' => lang('module_dashboard'),
'pages' => lang('module_pages'),
'blocks' => lang('module_blocks'),
'navigation' => lang('module_navigation'),
'assets' => lang('module_assets'),
'sitevariables' => lang('module_sitevariables')
);
and paste it inside MY_fuel.php ?
I tried this but this only applies to what's inside the "Site" tab ... not what i'm after! I want to re-order the modules like "BLOG" or "TOOLS" !
You also need to reset the 'nav' array, otherwise you module will still be at the end of the array. So MY_fuel.php goes like that:
$config['nav'] = array();
$config['nav']['site'] = array(...)
$config['nav']['MY_ADVANCED_MODULE'] = array();
...
$config['nav']['manage'] = array(...);