When an Interact client is ready to create a page, it calls the Page Renderer object to create it. In response, the Page Renderer object calls sub renderers (e.g., PageHeader renderer, Footer renderer, and so on) that create sub elements for the page DOM. If an extension is registered for a renderer’s extension point, it will be called with the appropriate context and the DOM element that was created in the base renderer. The extension then has all the information it needs to modify or ignore the element of the previous renderer. Alternatively, the extension can create a completely new DOM element using the context passed by the framework.
The following architecture diagram shows an example of how extensions of the PageHeader extension point are used to modify the original DOM element. Note that the extensions are called in a specific order, which is the order in which they are organized in the application's settings. For details, refer to Working with Extensions in the Admin Console.
Using Extensions to Modify the Client
Usually, extensions are used in one of the following ways:
- Registering a specific renderer that interjects the creation process of the DOM (as shown in the example above). This technique allows you to make system-wide modifications even before the page is fully rendered. However, a disadvantage of this method is that the DOM is not fully stable and can continue changing as the process continues.
- Registering the loaded event after the DOM is created. At this point, the DOM is stable, enabling you to select elements more accurately. You can manipulate the entire DOM structure by adding and removing DOM elements to/from the page according to the data context that is passed with each page. This method is recommended, for example, when you want to modify a specific Interaction element using a unique reference name.
When you create a new extension, the default code on the New Extension page prompts you to use one of these techniques to write the extension. For more details, refer to Working with Extensions in the Admin Console.