callbackAddForm

callbackAddForm(callable $callback)

This callback is used in case we need to change the default data that will appear at the add form (the modal for insert). Usually this callback is used when we need to add a default value at a field.

Example:

$crud->callbackAddForm(function ($data) {
    // At this example we assume that 
    // the reference id always starts with 0098_  
    // and hence we are adding it as a default  
    // value instead of empty
    $data['reference_id'] = '0098_';

    return $data;
});