Let the platform do the work

before_delete

Overview

The before_delete logic hook executes before a record is deleted.

Definition

  function before_delete($bean, $event, $arguments){}

Arguments

Name Type Description
bean Object The bean object
event String The current event
arguments Array Additional information related to the event
arguments.id String ID of the record to delete

Examples

Creating a Logic Hook using the Extension Framework

./custom/Extension/modules/<module>/Ext/LogicHooks/<file>.php

  <?php

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

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

        //The PHP file where your class is located.
        'custom/modules/<module>/before_delete_class.php',

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

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

?>

./custom/modules/<module>/before_delete_class.php

  <?php

    class before_delete_class
    {
        function before_delete_method($bean, $event, $arguments)
        {
            //logic
        }
    }

?>

Topics