Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Grouping Modules in the admin sidebar

edited August 2017 in Installation
Hi Admin,

Is there a way where-in we can group certain modules under the left sidebar of the admin panel. A more user friendly way of displaying certain sections of the website.

Like suppose we have 2 custom modules History page, Team, Management Team all to be displayed under collapsible About section.

Thanks.

Comments

  • edited 5:12PM
    Yes. You can overwrite the entire navigation array array in your MY_fuel.php file. By default, the array is the following:
    // Site... Dashboard will always be there $config['nav']['site'] = array( 'dashboard' => lang('module_dashboard'), 'pages' => lang('module_pages'), 'blocks' => lang('module_blocks'), 'navigation' => lang('module_navigation'), 'tags' => lang('module_tags'), 'categories' => lang('module_categories'), 'assets' => lang('module_assets'), 'sitevariables' => lang('module_sitevariables') ); // My modules... if set to empty array, then it will automatically include all in MY_fuel_modules.php $config['nav']['modules'] = array(); // Tools $config['nav']['tools'] = array(); // Manage $config['nav']['manage'] = array( 'users' => lang('module_users'), 'permissions' => lang('module_permissions'), 'manage/cache' => lang('module_manage_cache'), 'logs' => lang('module_manage_activity'), 'settings' => lang('module_manage_settings'), );

    Additionally, there is a $config['nav_auto_arrange'] = TRUE; parameter you can set in MY_fuel.php which will give you some more flexibility in the ordering if set to FALSE.
  • edited 5:12PM
    Okay, I will try this!

    Will this overwrite also handle the permission being set for individual user?
  • edited 5:12PM
    The permissions will work the same.
  • edited 5:12PM
    Hi Admin,

    I tried to implement your solution by adding the below line

    $config['nav']['modules'] = array('My Group' => array('healthcare' => 'healthcare', 'benefits' => 'benefits'));
    But I received the below error: Can you suggest an alternative or may be I missed out on something.

    A PHP Error was encountered
    Severity: Notice

    Message: Array to string conversion

    Filename: core/Loader.php(392) : eval()'d code

    Line Number: 65

    Backtrace:

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\core\Loader.php(392) : eval()'d code
    Line: 65
    Function: _error_handler

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\core\Loader.php
    Line: 392
    Function: eval

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\core\Loader.php
    Line: 323
    Function: _ci_load

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\core\Loader.php
    Line: 462
    Function: view

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\core\Loader.php(392) : eval()'d code
    Line: 22
    Function: module_view

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\core\Loader.php
    Line: 392
    Function: eval

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\core\Loader.php
    Line: 323
    Function: _ci_load

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\core\Loader.php
    Line: 462
    Function: view

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\libraries\Fuel_admin.php
    Line: 266
    Function: module_view

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\controllers\Dashboard.php
    Line: 30
    Function: render

    File: D:\wamp64\www\FUEL-CMS-master\index.php
    Line: 364
    Function: require_once
    This error is displayed in the left sidebar of the admin panel. Below the error, I got one single module entry titled as 'Array' and linked to http://localhost/FUEL-CMS-master/admin/My Group .
    I got what the code does but just wanted to know if there is a way to achieve a collapsible head under which certain modules could be grouped same as Site, Modules, Tools, Manage titles.

    Thanks.
  • edited 5:12PM
    The nav array should only be 2 arrays deep. In your case, you have specified "My Group" to be under the "modules" group. Instead, try the following:
    $nav['my_group'] = array('healthcare' => 'healthcare', 'benefits' => 'benefits');
  • edited 5:12PM
    Awesome, I have a section now which reads my_group but still all the modules are visible under modules section. Here is my code!

    //$config['nav']['modules'] = array();

    $config['nav']['my_group'] = array('healthcare' => 'healthcare');
    If I can have all the modules sorted and bifurcated then I wont need the modules section in the left side bar. Any ways to hide the section?
  • edited 5:12PM
    You can just unset that part of the $nav array:
    unset($config['nav']['modules']);
  • edited 5:12PM
    I guess this works, now I don't see modules section in the left side bar but this caused another issue to pop-up right on the dashboard

    A PHP Error was encountered
    Severity: Notice

    Message: Undefined index: modules

    Filename: libraries/Fuel_admin.php

    Line Number: 536

    Backtrace:

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\libraries\Fuel_admin.php
    Line: 536
    Function: _error_handler

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\libraries\Fuel_admin.php
    Line: 138
    Function: nav

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\libraries\Fuel_base_controller.php
    Line: 55
    Function: initialize

    File: D:\wamp64\www\FUEL-CMS-master\fuel\modules\fuel\controllers\Dashboard.php
    Line: 8
    Function: __construct

    File: D:\wamp64\www\FUEL-CMS-master\index.php
    Line: 364
    Function: require_once
    I changed line 536 with

    //$arranged_nav['modules'] = $orig_nav['modules'];
    $arranged_nav['modules'] = isset($orig_nav['modules']) ? $orig_nav['modules'] : array();
    to solve the issue
  • edited 5:12PM
    You can also try adding the following to your fuel/application/config/MY_fuel.php
    $config['nav_auto_arrange'] = TRUE;
Sign In or Register to comment.