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 Reply Children
  • This does not work. 
    Inside /custom/Extension/modules/Opportunities/Ext/Layoutdefs/custom.php I have this which is not working:

    <?php  $layout_defs["Opportunities"]["subpanel_setup"]['foo_Foobar_1'] = array (  
    'order' => 1,
      'module' => 'foo_Foobar',
      'subpanel_name' => 'default',
      'sort_order' => 'asc',
      'sort_by' => 'id',
      'title_key' => 'LBL_FOO_FOOBAR_1_TITLE',
      'get_subpanel_data' => 'foo_Foobar_1',
      'top_buttons' =>
      array (
        0 =>
        array (
          'widget_class' => 'SubPanelTopButtonQuickCreate',
        ),
        1 =>
        array (
          'widget_class' => 'SubPanelTopSelectButton',
          'mode' => 'MultiSelect',
        ),
      ),
    );
  • Hi Karl Metum,
    Check all the other subpanel order number then...

    and change them accordingly....

    because the above code is working here....

    Thank & Regards
    Sumit Sahay

  • Are you on v7.x?
    I tried replacing the key 'top_buttons' with an empty array just to see if it affects the subpanel. But it doesn't. Changes in this file does not seem to affect the view at all.
  • 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.