How to change subpanel order in SugarCRM 7?

How can one change the order on each subpanel either by code or through the GUI?
In Sugar 6 the user could change the order simply by dragging and dropping the subpanels under each module. 
From what I can see this is not possible in 7.x. 
I have tried to change
'order' => 1 
in
custom/Extension/modules/Opportunities/Ext/Layoutdefs/some_file.php 
with no luck at all..

Any ideas?
Parents
  • Hi Karl Metum,
    <?php
    $layout_defs['Accounts']["subpanel_setup"]['history']['order'] = 10;
    ?>

    Check this in layoutdefs folder...

    It will work...

    Thanks & Regards
    Sumit Sahay


  • the 'order' => 1, does not seems to work on Sugar 7.x. 
    The reason is this: 

    Inside include/MetaDataManager/MetaDataConverter.php:327

    public function toLegacySubpanelLayoutDefs(array $layoutDefs, SugarBean $bean)    {
       ..
       foreach ($layoutDefs as $order => $def) {
       ..
           $return[$def['context']['link']] = array(
                    'order' => $order,
        ..
     }

    So the order here is based on which order each bean is inserted inside the 'components'-key inside this file:
    modules/Opportunities/clients/base/layouts/subpanels/subpanels.php

    Core modules are hard-coded inside the subpanel file for Opportunities so one can not override this order with custom module without having to modify core files. 

    To see this in action: 
    1. Rebuild you cache. 
    2. Edit cache/modules/Opportunities/clients/base/layout.php and change the index of your custom module from last index to 0. 
    In my case it looked like this: 

    'subpanels' =>   array (
        'meta' => 
        array (
          'components' => 
          array (
            0 => 
            array (
              'layout' => 'subpanel',
              'label' => 'LBL_CALLS_SUBPANEL_TITLE',
              'context' => 
              array (
                'link' => 'calls',
              ),
            ),
            1 => 
            array (
              'layout' => 'subpanel',
              'label' => 'LBL_MEETINGS_SUBPANEL_TITLE',
              'context' => 
              array (
                'link' => 'meetings',
              ),
            ),
            2 => 
            array (
              'layout' => 'subpanel',
              'label' => 'LBL_TASKS_SUBPANEL_TITLE',
              'context' => 
              array (
                'link' => 'tasks',
              ),
            ),
           
    .. (removed a lot of entries)
            ),
            11 => 
            array (
              'layout' => 'subpanel',
              'label' => 'LBL_OPPORTUNITIES_FOOBAR_FROM_FOOBAR_TITLE',
              'context' => 
              array (
                'link' => 'opportunities_foobar_1',
              ),
            ),
          ),
        ),
      ),

    Here I changed number 11 to 0. And changed the first entry which had the key 0 to 11 instead. 
    Cleared browser's cache and refreshed the page and voila! The custom module is now presented at the top of all subpanels. 
    The downside is that this change is overwritten once cache has been rebuilt. 
Reply
  • the 'order' => 1, does not seems to work on Sugar 7.x. 
    The reason is this: 

    Inside include/MetaDataManager/MetaDataConverter.php:327

    public function toLegacySubpanelLayoutDefs(array $layoutDefs, SugarBean $bean)    {
       ..
       foreach ($layoutDefs as $order => $def) {
       ..
           $return[$def['context']['link']] = array(
                    'order' => $order,
        ..
     }

    So the order here is based on which order each bean is inserted inside the 'components'-key inside this file:
    modules/Opportunities/clients/base/layouts/subpanels/subpanels.php

    Core modules are hard-coded inside the subpanel file for Opportunities so one can not override this order with custom module without having to modify core files. 

    To see this in action: 
    1. Rebuild you cache. 
    2. Edit cache/modules/Opportunities/clients/base/layout.php and change the index of your custom module from last index to 0. 
    In my case it looked like this: 

    'subpanels' =>   array (
        'meta' => 
        array (
          'components' => 
          array (
            0 => 
            array (
              'layout' => 'subpanel',
              'label' => 'LBL_CALLS_SUBPANEL_TITLE',
              'context' => 
              array (
                'link' => 'calls',
              ),
            ),
            1 => 
            array (
              'layout' => 'subpanel',
              'label' => 'LBL_MEETINGS_SUBPANEL_TITLE',
              'context' => 
              array (
                'link' => 'meetings',
              ),
            ),
            2 => 
            array (
              'layout' => 'subpanel',
              'label' => 'LBL_TASKS_SUBPANEL_TITLE',
              'context' => 
              array (
                'link' => 'tasks',
              ),
            ),
           
    .. (removed a lot of entries)
            ),
            11 => 
            array (
              'layout' => 'subpanel',
              'label' => 'LBL_OPPORTUNITIES_FOOBAR_FROM_FOOBAR_TITLE',
              'context' => 
              array (
                'link' => 'opportunities_foobar_1',
              ),
            ),
          ),
        ),
      ),

    Here I changed number 11 to 0. And changed the first entry which had the key 0 to 11 instead. 
    Cleared browser's cache and refreshed the page and voila! The custom module is now presented at the top of all subpanels. 
    The downside is that this change is overwritten once cache has been rebuilt. 
Children
No Data