Let the platform do the work

server_round_trip

Overview

Executes at the end of every page.

Definition

function server_round_trip($event, $arguments){}

Arguments

Name Type Description
event String The current event
arguments Array Additional information related to the event (typically empty)

Considerations

  • This is a global logic hook where the logic hook reference must be placed in ./custom/modules/logic_hooks.php.
  • If you are intending to write display logic to the screen, you must first wrap the display logic in an if condition to prevent breaking the Ajax page loads:
    if (!isset($_REQUEST["to_pdf"]) || $_REQUEST["to_pdf"] == false)
    {
        //display logic
    }
  • This hook is executed on all page loads.
  • Application hooks do not make use of the $bean argument.

Change Log

Version Note
5.0.0a Added server_round_trip hook.

Example

./custom/modules/logic_hooks.php

<?php

    $hook_version = 1;
    $hook_array = Array();

    $hook_array['server_round_trip'] = Array();
    $hook_array['server_round_trip'][] = Array(
        //Processing index. For sorting the array.
        1, 

        //Label. A string value to identify the hook.
        'server_round_trip example', 

        //The PHP file where your class is located.
        'custom/modules/application_hooks_class.php', 

        //The class the method is in.
        'application_hooks_class', 

        //The method to call.
        'server_round_trip_method' 
    );

?>

./custom/modules/application_hooks_class.php

<?php

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

    class application_hooks_class
    {
        function server_round_trip_method($event, $arguments)
        {
            //display logic should check for $_REQUEST["to_pdf"]
        }
    }

?>