Edit This Page

Callbacks

Callback functions are based on the event dispatcher pattern. You can register one or more callbacks for a certain event and when the event is triggered, the callback functions are being executed. Callbacks allow you to customize the program flow of the Contao core engine.

Global callbacks

Callback Description
onload_callback Is executed when the DataContainer object is initialized. Allows you to e.g. check permissions or to modify the Data Container Array dynamically at runtime.
onsubmit_callback Is executed when a back end form is submitted. Allows you to e.g. modify the form data before it is written to the database (used to calculate intervals in the calendar extension).
ondelete_callback Is executed before a record is removed from the database.
oncut_callback Is executed after a record has been moved to a new position.
oncopy_callback Is executed after a record has been duplicated.

Listing callbacks

Callback Description
paste_button_callback Allows for individual paste buttons and is e.g. used in the site structure to disable buttons depending on the user's permissions (requires an additional command check via load_callback).
child_record_callback Defines how child elements are rendered in "parent view".
group_callback Allows for individual group headers in the listing.
label_callback Allows for individual labels in the listing and is e.g. used in the user module to add status icons.

Operations callbacks

Callback Description
button_callback Allows for individual navigation icons and is e.g. used in the site structure to disable buttons depending on the user's permissions (requires an additional command check via load_callback).

Field callbacks

Callback Description
options_callback Allows you to define an individual function to load data into a drop-down menu or checkbox list. Useful e.g. for conditional foreinKey-relations.
input_field_callback Allows for the creation of individual form fields and is e.g. used in the back end module "personal data" to generate the "purge data" widget. Attention: the field is not saved automatically!
load_callback Is executed when a form field is initialized and can e.g. be used to load a default value.
save_callback Is executed when a field is submitted and can e.g. be used to add an individual validation routine.