SugarCRM SupportProduct GuidesSugar DeveloperSugar Developer Guide 11.0ArchitectureBackward CompatibilityEnabling Backward Compatibility

Enabling Backward Compatibility

Overview

How to enable backward compatibility for a module.

Enabling Backward Compatibility

Backward Compatibility Mode is not a permanent solution for modules with legacy customizations. If you should need to temporarily get a module working due to legacy customizations, you can follow the steps below to enable the legacy MVC framework. Please note that switching stock Sugar modules from the Sidecar framework to backward compatibility mode is not supported and may result in unexpected behaviors in the application.

Enabling BWC

To enable backward compatibility, you must first create a file in ./custom/Extension/application/Ext/Include/ for the module. If the module is custom, there will already be an existing file in this folder pertaining to the module that you can edit.

./custom/Extension/application/Ext/Include/<file>.php

<?php

$bwcModules[] = '<module key>';

Once the file is in place, you will need to navigate to Admin > Repair > Quick Repair and Rebuild. The Quick Repair can wait until you have completed the following sections for this customization.

Once you have enabled backward compatibility for a module, you will then need to manually update the module's link in the MegaMenu. This will control the navigation when a user clicks the actual module name on the MegaMenu.

./custom/modules/<module>/clients/base/layouts/records/records.php

<?php

$viewdefs['<module key>']['base']['layout']['records'] = array(
    'name' => 'bwc',
    'type' => 'bwc',
    'components' =>
    array(
        array(
            'view' => 'bwc',
        ),
    ),
);

Once the file is in place, you will need to navigate to Admin > Repair > Quick Repair and Rebuild. The Quick Repair can wait until you have completed the following section for this customization.

Once you have updated the MegaMenu module link, you will then need to manually update the module's MegaMenu action links.

The module's deployed sub-navigation links for a module will be similar to the file shown below:

./modules/<module>/clients/base/menus/header/header.php

<?php

$moduleName = '<module key>';

$viewdefs[$moduleName]['base']['menu']['header'] = array(
    array(
        'route' => "#$moduleName/create",
        'label' => 'LNK_NEW_RECORD',
        'acl_action' => 'create',
        'acl_module' => $moduleName,
        'icon' => 'icon-plus',
    ),
    array(
        'route' => "#$moduleName",
        'label' => 'LNK_LIST',
        'acl_action' => 'list',
        'acl_module' => $moduleName,
        'icon' => 'icon-reorder',
    ),
    array(
        'route' => "#bwc/index.php?module=Import&action=Step1&import_module=$moduleName&return_module=$moduleName&return_action=index",
        'label' => 'LBL_IMPORT',
        'acl_action' => 'import',
        'acl_module' => $moduleName,
        'icon' => '',
    ),
);

This file should be duplicated to the custom directory and edited to adjust the URLs to the BWC format. The example below demonstrates the changes needed to the duplicated file.

./custom/modules/<module>/clients/base/menus/header/header.php

<?php

$moduleName = '<module key>';

$viewdefs[$moduleName]['base']['menu']['header'] = array(
    array(
        'route' => "#bwc/index.php?module=$moduleName&action=EditView",
        'label' => 'LNK_NEW_RECORD',
        'acl_action' => 'create',
        'acl_module' => $moduleName,
        'icon' => 'icon-plus',
    ),
    array(
        'route' => "#bwc/index.php?module=$moduleName&action=ListView",
        'label' => 'LNK_LIST',
        'acl_action' => 'list',
        'acl_module' => $moduleName,
        'icon' => 'icon-reorder',
    ),
    array(
        'route' => "#bwc/index.php?module=Import&action=Step1&import_module=$moduleName&return_module=$moduleName&return_action=index",
        'label' => 'LBL_IMPORT',
        'acl_action' => 'import',
        'acl_module' => $moduleName,
        'icon' => '',
    ),
);

Once the file is in place, you will need to navigate to Admin > Repair > Quick Repair and Rebuild.

Verifying BWC Is Enabled

To verify that backward compatibility is enabled, you can inspect App.metadata.get().modules after running a Quick Repair and Rebuild in your browser's console window:

Using Developer Tools in Google Chrome

  1. Open Developer Tools
    • This can be done in the following ways:
      1. Command + Option + i

      2. View > Developer > Developer Tools

      3. Right-click on the web page and selecting "Inspect Element"

  2. Select the "Console" tab

  3. Run the following command, replacing <module key> and verify that it returns true:

App.metadata.get().modules.<module key>.isBwcEnabled

Using Firebug in Google Chrome or Mozilla Firefox

  1. Open Firebug
  2. Select the "Console" tab

  3. Run the following command, replacing <module key>, and verify that it returns true:

App.metadata.get().modules.<module key>.isBwcEnabled

Last modified: 2021-02-17 02:44:13