Let the platform do the work

Creating Custom Entry Points

Overview

As of 6.3.x, entry points can be created using the extension framework. The entry point extension directory, located at ./custom/Extension/application/Ext/EntryPointRegistry/, is compiled into ./custom/application/Ext/EntryPointRegistry/entry_point_registry.ext.php after a Quick Repair and Rebuild. Additional information can be found in the extensions EntryPointRegistry section.

Custom Entry Points

Prior to 6.3.x, an entry point could be added by creating the file ./custom/include/MVC/Controller/entry_point_registry.php. This method of creating entry points is still compatible but is not recommended from a best practices standpoint as duplicating ./include/MVC/Controller/entry_point_registry.php to ./custom/include/MVC/Controller/entry_point_registry.php will prevent any upgrader updates to ./include/MVC/Controller/entry_point_registry.php from being reflected in the system. Entry point registries contain two properties:

  • file - The path to the entry point.
  • auth - A Boolean value that determines whether or not the user must be authenticated in order to access the entry point.
  $entry_point_registry['customEntryPoint'] = array(
    'file' => 'path/to/customEntryPoint.php',
    'auth' => true
);

Example

The first step is to create the actual entry point. This is where all of the logic for your entry point will be located. This file can be located anywhere you choose. For my example, I will create:

./custom/customEntryPoint.php

  <?php

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

echo "Hello World!";

Next, we will need to create our extension in the application extensions. This will be located at:
./custom/Extension/application/Ext/EntryPointRegistry/customEntryPoint.php

  <?php

$entry_point_registry['customEntryPoint'] = array(
    'file' => 'custom/customEntryPoint.php',
    'auth' => true
);

Finally, navigate to Admin > Repair > Quick Repair and Rebuild. The system will then generate the file ./custom/application/Ext/EntryPointRegistry/entry_point_registry.ext.php containing your registry entry. We are now able to access our entry point by navigating to:

http://{sugar url}/index.php?entryPoint=customEntryPoint

Topics