Overview
How to create custom entry points.
Creating a Custom Entry Point
As of 6.3.x, entry points can be created using the extension framework. The entry point extension directory is located at ./custom/Extension/application/Ext/EntryPointRegistry/. Entry point files found is this directory will be compiled into ./custom/application/Ext/EntryPointRegistry/entry_point_registry.ext.php after a Quick Repair and Rebuild. Prior to 6.3.x, an entry point was 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.
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
./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