EntryPointRegistry
Overview
The EntryPointRegistry
extension maps additional entry points to the system. Please note that entry points will soon be deprecated. Developers should move custom logic to endpoints. For more information, please refer to the Entry Points page.
Properties
The following extension properties are available. For more information, please refer to the Extension Property documentation.
Property | Value |
Extension Scope | Application |
Sugar Variable | $entry_point_registry |
Extension Directory | ./custom/Extension/application/Ext/EntryPointRegistry/ |
Compiled Extension File | ./custom/application/Ext/EntryPointRegistry/entry_point_registry.ext.php |
Manifest Installdef | $installdefs['entrypoints'] |
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/application/Ext/EntryPointRegistry/
to map a new entry point in the system. The following example will create a new entry point called exampleEntryPoint
that will display the text, "Hello World":
./custom/Extension/application/Ext/EntryPointRegistry/<file>.php
<?php
$entry_point_registry['exampleEntryPoint'] = array(
'file' => 'custom/exampleEntryPoint.php',
'auth' => true
);
Next, create the file that will contain the entry point logic. This file can be located anywhere you choose, but we recommend putting it in the custom directory. More information on custom entry points can be found on the Creating Custom Entry Points page.
./custom/exampleEntryPoint.php
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
echo "Hello World!";
Next, navigate to Admin > Repair > Quick Repair and Rebuild.The system will then rebuild the extensions and compile your customization into ./custom/application/Ext/EntryPointRegistry/entry_point_registry.ext.php
Module Loadable Package
When building a module loadable package, you can use the $installdefs['entrypoints']
index to install the extension file.
Installdef Properties
Name | Type | Description |
from | String | The base path of the file to be installed. |
The example below demonstrates the proper install definition that should be used in the ./manifest.php
file, in order to add the Entry Point Extension file to the system. You should note that when using this approach, you still need to use the $installdefs['copy']
index for the entry point's logic file, however Sugar will automatically execute Rebuild Extensions to reflect the new Entry Point in the system.
./manifest.php
<?php
$manifest = array(
...
);
$installdefs = array(
'id' => 'entryPoint_Example',
'entrypoints' => array(
array(
'from' => '<basepath>/Files/custom/Extension/application/Ext/EntryPointRegistry/<file>.php'
)
),
'copy' => array(
array(
'from' => '<basepath>/Files/custom/exampleEntryPoint.php',
'to' => 'custom/exampleEntryPoint.php'
)
)
);
Alternatively, you may use the $installdefs['copy']
index for the Entry Point 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 the $installdefs['copy']
index and module loadable packages, please refer to the Introduction to the Manifest page.