Add an extension or button onto the home or SystemAdministration or any other page

This page is about helping you to add an extension such as a link or an icon or button onto either the home page or any other page within the Reference Application.

I hope you want to add something that looks like any of these components below onto either the home or System Administration or any other page outside your module.

In the above image, i have buttons, links which can be added  onto another page outside your module by taking use of the extension feature within the UI Framework.

Let us for-example add the "Manage ChartSearch" button extension onto the System Administration page which appears when the user clicks the System Administration button on the home page.

All you need to do is to add a json file into your moduleId-omod/src/main/resources/apps/ folder which defines the details of the extension.

In my case for-example, i have added chartSearch_app.json file.

The code looks to  include into the file looks like:

chartsearch-omod/src/main/resources/apps/chartSearch_app.json
[
    {
        "id": "${project.parent.artifactId}.chartSearchApp",
        "description": "${project.parent.artifactId}.refApp.description",
        "order": 10,
        "extensions": [
            {
                "id": "${project.parent.artifactId}.launcheManager",
                "extensionPointId": "systemAdministration.apps",
                "type": "link",
                "order": 10,
                "label": "chartsearch.refApp.manageChartSearch",
                "url": "chartsearch/manageChartSearch.page",
                "icon": "icon-search",
                "requiredPrivilege": "Task: Chart Search"
            }
        ]
    }
] 

In above code snippet: we have ids that unify your extension from any other one already available like on line 3 and 8.

The most important parts that you are in most cases going to be changing are, id, extensionPointId, label and url. 

The ExtensionPointId as on line 9 refers to another extension already existing by its ID, in this case i used; 

systemAdministration.apps which is the one used to adding an extension onto .../coreapps/systemadministration/systemAdministration.page

In-case you want to add one instead onto the home page, then you should change that to: org.openmrs.referenceapplication.homepageLink

Since my extension type is configured as a link, i set the url to the URL that will be launched when the user clicks the button