before_filter
Overview
The before_filter
hook executes when the v10+ REST Service is about to route the request.
Definition
function before_filter($bean, $event, $arguments){}
Arguments
Name | Type | Description |
---|---|---|
bean | Object | An empty bean object of the module being queried. |
event | String | The name of the logic hook event. |
arguments | Array | Additional information related to the event. |
arguments[0] | Object | The SugarQuery Object |
arguments[1] | Array | The query options |
Considerations
- This hook can be executed for a specific module in ./custom/modules/<module>/logic_hooks.php or globally in ./custom/modules/logic_hooks.php.
- This hook can change request object parameters that influence routing.
- This hook should not be used for any type of display output.
Change Log
Version | Note |
---|---|
7.0.0RC1 | Added before_filter hook |
Example
./custom/modules/{module}/logic_hooks.php
<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['before_filter'] = Array();
$hook_array['before_filter'][] = Array(
//Processing index. For sorting the array.
1,
//Label. A string value to identify the hook.
'before_filter example',
//The PHP file where your class is located.
'custom/modules/{module}/logic_hooks_class.php',
//The class the method is in.
'logic_hooks_class',
//The method to call.
'before_filter_method'
);
?>
./custom/modules/{module}/logic_hooks_class.php
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class logic_hooks_class
{
function before_filter_method($bean, $event, $arguments)
{
//logic
}
}
?>