SugarCRM SupportDocumentationSugar DeveloperSugar Developer Guide 9.0ArchitectureExtensionsActionViewMap
This page refers to content that is only available in modules running in backward compatibility mode.

ActionViewMap

Overview

The ActionViewMap extension maps additional actions for a module.

Note: Actions that apply to modules running in backward compatibility mode are mapped in ./custom/modules/<module>/controller.php.

Properties

The following extension properties are available. For more information, please refer to the Extension Property documentation.

Property Value
Extension Scope Module
Sugar Variable $action_view_map
Extension Directory ./custom/Extension/modules/<module>/Ext/ActionViewMap/
Compiled Extension File ./custom/<module>/Ext/ActionViewMap/action_view_map.ext.php
Manifest Installdef $installdefs['action_view_map']

Implementation

The following sections illustrate the various ways to implement a customization to a Sugar instance.

File System

When working directly with the filesystem, you can create a file in ./custom/Extension/modules/<module>/Ext/ActionViewMap/ to map a new view in the system. The following example will map a new action called 'example' to the 'example' view:

./custom/Extension/modules/<module>/Ext/ActionViewMap/<file>.php

<?php

$action_view_map['example'] = 'example';

./custom/modules/<module>/views/view.example.php

<?php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('include/MVC/View/views/view.detail.php');

class <module>ViewExample extends ViewDetail
{
    function <module>ViewExample()
    {
        parent::ViewDetail();
    }
    function display()
    {
        echo 'Example View';
    }
}
?>

Next, navigate to Admin > Repair > Quick Repair and Rebuild. The system will then rebuild the extensions and compile your customization into ./custom/modules/<module>/Ext/ActionViewMap/action_view_map.ext.php.

Module Loadable Package

When building a module-loadable package, use the $installdefs['action_view_map'] index to install the extension file.

Installdef Properties

Name Type Description
from String The basepath of the file
to_module String The key for the module where the file will be installed

The example below demonstrates the proper install definition for the ./manifest.php file in order to add the Action View Map file to a specific module. You should note that when using this approach, you still need to use the $installdefs['copy'] index for the View file, however, Sugar will automatically execute Rebuild Extensions to reflect the new Action View in the system.

./manifest.php

<?php

$manifest = array(
    ...
);

$installdefs = array(
    'id' => 'actionView_example',
    'action_view_map' => array(
        array(
            'from' => '<basepath>/Files/custom/Extension/modules/<module>/Ext/ActionViewMap/<file>.php',
            'to_module' => '<module>',
        )
    ),
    'copy' => array(
        array(
            'from' => '<basepath>/Files/custom/modules/<module>/views/view.example.php',
            'to' => 'custom/modules/<module>/views/view.example.php',
        ),
    )
);

Alternatively, you may use the $installdefs['copy'] index for the Action View Map Extension file. When using this approach, you may need to manually run repair actions such as a Quick Repair and Rebuild.

For more information on module-loadable packages, please refer to the Introduction to the Manifest page .

Last modified: 2019-03-13 02:04:19