Sidebar

Using iTop

Creating your iTop

iTop Customization

"How to" examples
DataModel

User Interface

Automation & Ticket management

Portal Customization

Extensibility API

Using the extension mechanism, you can add / modify / delete iTop objects, and change the application (menus, user rights, …)

But iTop is also providing some means to alter the application behavior using PHP.

Object manipulation API

When adding new behaviors, you'll surely have to :

  • Retrieve objects from database
  • Get attributes of a retrieved object
  • Modify an object in memory
  • Store the modification to database

In the following document you'll learn how to do that in PHP : API for searching objects, manipulating them,....

Business logic on objects

Since iTop 3.1.0, the preferred way to add business logic on objects creation / modification / deletion is to use the new event system. But before this version we had two API. Here is a comparison between the 3 API :

API Support Limitation
CRUD events Since iTop 3.1, though still experimental ⚗️ ➕ Has been designed having in mind the caveats of the two original methods
➕ Multiple events available
➕ Multiple extensions can listen for the same event, and order can be defined
➕ Listeners can be part of the object definition
➕ XML extensibility mechanism (_delta attribute)
➕ Any extension can add its own events
DBObject methods override Since iTop 1.0 ➕ Can be included in the object definition (good for processing needed for object integrity)
➕ XML extensibility mechanism (_delta attribute)
➖ Can only customize iTop objects CRUD operations
➖ Only one method override possible
➖ Requires a precise understanding of the CRUD stack (method to implement, getting previous values, objects reload, …)
iApplicationObjectExtension Since iTop 1.0, aimed at being deprecated at some point in time ➕ Multiple implementation possible
➕ Many behaviors can be customized (iTop objects CRUD operations, menus, web page content, …)
➖ No rank
CRUD : just a few callbacks possible

Events

All the details on this extensibility API: Events API - Adding new events, firing them, while others are listening and reacting on event occurrence.

This extensibility API was added in iTop 3.1.0
When available for what you want to do, it is the recommended one

iTop interfaces API

In practice, your code consists in declaring a PHP class implementing an interface known by iTop as being an extension interface. iTop detects automatically the existence of your class and invokes the methods at some specific moments during its execution.

To make this happen, the code of your class must be in a file included by iTop, so included either in:

To learn more about the available interfaces : Interfaces API

DBObject methods override

  • Multiple DBObject methods are meant to be overridden to implement custom behaviors : if so they contains the overwritable-hook tag in their phpdoc block.
  • Some can be used to implement custom behaviors in the CRUD stack (Create, Update, Delete) for new iTop objects, also events are preferred in that case.
  • To see when those methods are called, check the crud stack map
Only one override can be defined on a class! This could be a major drawback of this extensibility API:
as two extension modules can become concurrent, one module erasing another module customization, just because it was loaded last at Setup.
That's why Events API or Interfaces API are preferable when there is a risk of concurrence
latest/customization/extensions_api.txt · Last modified: 2023/08/23 16:13 (external edit)
Back to top
Contact us