Content Providers


The "content provider" plays a crucial role in data management within the application. It acts as the component responsible for the operational logic throughout the entire layout. Through its functionalities defined by the developer, the "content provider" ensures the proper functioning and consistency of the layout elements by making sure that data is appropriately retrieved, manipulated, and displayed. In summary, the "content provider" ensures the smooth execution of operations within the application, guaranteeing an optimal user experience.

content provider
Schema Content Provider

Content Provider in Activator Client

 

Content Provider
Content Provider

In the image above, it is the content provider that will load the information to be displayed in each layout.

Content Provider in Activator Admin

In Activator Admin, the "MENU ITEMS DRIVER" module is located in the menu container, among the items listed under </>Pages and Navigation.

✍️Note: Make sure you are in the main module of system components.

Configuration of the Content Provider
To define the operational logic, simply fill in the properties of the content provider during its creation:
- The Name: (Only modify the part with: newcontentProvider1)
- The Description: (Only modify the part with: newcontentProvider1)
- Definition: which is the content of the JavaScript file that will contain all the code written by the developer.

By default, it is defined as follows:

$activator.ui.jsmodules.define(function () {
    // Called to render the content
    this.render = function (context) {
        return new Promise((resolve, reject) => {
            //create your logic here
            resolve();
        });
    };
});

This code is a JavaScript module that defines a function called "render" in the context of the Activator Client user interface.
More specifically:

 

FUNCTION OR METHODDesciption
"define"It is a function used to define a JavaScript module.
"this.render"It is a method that will be called to render the content in the Activator Client interface.
The "render" function generally takes a parameter "(context)"which can contain data or references necessary for rendering the content.
Inside the "render" methodthere is an asynchronous code block that returns a Promise. Within this block, you can add your rendering logic to generate the interface content based on the provided context.

Conclusion

Content providers are pivotal in managing data within the Activator application. They ensure the operational logic throughout the entire layout, facilitating data retrieval, manipulation, and display. By handling these processes, content providers contribute significantly to the smooth execution of operations, guaranteeing an optimal user experience. Proper configuration of content providers in Activator Admin involves defining properties and operational logic through JavaScript modules, which enable developers to tailor the functionality to meet specific needs. This flexible and efficient management system is crucial for the platform's adaptability and ongoing maintenance.