Question

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..

Was it helpful?

Solution

UPDATE: As UTAlan stated, this will become part of the stock functionality of Sugar starting in version 7.5.0: https://web.sugarcrm.com/support/issues/66590

Until then, here is the reason and the solution:

The 'order' => 1, does not seem to work on Sugar 7 at the moment.

Solution

Copy the file

modules/Opportunities/clients/base/layouts/subpanels/subpanels.php

to

custom/modules/Opportunities/clients/base/layouts/subpanels/subpanels.php

Now, add your custom subpanel definition to the beginning of the array or in any order you desire.

My example looks like this now:

$viewdefs['Opportunities']['base']['layout']['subpanels'] = array(
    'components' => array(
        // This is my custom module
        array(
            'layout' => 'subpanel',
            'label' => 'LBL_OPPORTUNITIES_FOOBAR_TITLE',
            'context' => array(
                'link' => 'opportunities_foobar_1',
            ),
        ),

        .. // Code ommited
        array(
            'layout' => 'subpanel',
            'label' => 'LBL_EMAILS_SUBPANEL_TITLE',
            'context' => array (
                'link' => 'archived_emails',
            ),
        ),
    ),
    'type' => 'subpanels',
    'span' => 12,
);

Long Answer:

Why is 'order' => 1 not working anymore?

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,
    ..
 }

The order that is being rendered in the view is based on which order each bean-name 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.

OTHER TIPS

This will become part of the stock functionality of Sugar starting in version 7.5.0: https://web.sugarcrm.com/support/issues/66590

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top