Extending Fuel_base_controller with custom left_sidebar nav sorting

edited June 2011 in Feature Requests
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

  • edited 5:37PM
    To change the order of the nav, you can use your fuel/application/config/MY_fuel.php file and overwrite the $config['nav'] value. To do that, I would first go to the fuel/modules/fuel/config/fuel.php configuration file and copy the values of the $config['nav'] starting around line 222 and going to line 249 or so and pasting it in your MY_fuel.php file. Then you can rearrange the order of that array to your liking.
  • edited 5:37PM
    so you mean i should copy this from modules/fuel/config/fuel.php


    $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" !
  • edited 5:37PM
    Actually all the $config['nav'] values (to line 249 or so). Then reorder it how you want.
  • edited 5:37PM
    Thanks.

    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(...);
  • edited 5:37PM
    Thanks for this! Would be great in the advanced user guide.
Sign In or Register to comment.