Skip to content

Modules

Keramat Jokar edited this page May 13, 2024 · 1 revision

What is a module?

We use a system structure called Hierarchical Model View Controller (HMVC) which pretty much is a way to package the more or less industry standard MVC-structure into extensions or packages. Each module folder has it's own set of controllers, models and views.

Our modules are located in application/modules/ and may have the following structure:

myModule
    config
        myConfig.php
    controllers
        myController.php
    models
        myModel.php
    views
        myView.tpl

Module manifest

Each module needs to have a manifest.json file with some basic information, see example below:

{
    "name": "My module name",
    "description": "Lets you do something",
    "version": "1.0.0",
    "date": "2023-01-01",

    "author": {
        "name": "Keramat Jokar",
        "website": "https://keramatjokar.ir/"
    },
    
    "enabled": true
}

"Enabled" is a runtime value that will be modified by the system if the administrator decides to disable or enable your module.

If you want to provide admin panel pages with your module, you have to add some more information to the manifest:

{
    "name":"Admin user manager",
    "description":"User management tools for the admin panel",
    "version": "1.0.0",
    "date": "2023-01-01",
    
    "author":
    {
        "name":"FusionCMS",
        "website":"https://fusion-hub.com"
    },

    "admin":
    {
        "group":
        {
            "text":"Users",
            "icon":"users",
            "links":
            [
                
                {
                    "text":"Accounts",
                    "icon":"users",
                    "controller":"accounts"
                },
                
                {
                    "text":"User group & permission",
                    "icon":"cogs",
                    "controller":"aclmanager"
                },

                {
                    "text":"Active sessions",
                    "icon":"cloud-word",
                    "controller":"sessions"
                }
            ]
            
        }
    },
    
    "enabled":true
}

If a menu group exists with the same group name, your link will be added to the existing one. If not, a new menu section will be created on the admin panel.

You can find the icons here: Font Awesome

Clone this wiki locally