Any module needs the manifest.json file. The file should be located in the module's primary directory (ui/modules/module_name/manifest.json
).
As a bare minimum, manifest.json should specify these fields:
{
"manifest_version": 2.0,
"id": "my_ip_address",
"name": "My IP Address",
"namespace": "MyIPAddress",
"version": "1.0"
}
Parameters supported in manifest.json (press on the parameter name for a detailed description):
Parameter | Description | Required |
---|---|---|
manifest_version | Manifest version of the module. | Yes |
id | Unique module ID. | |
name | Module name that will be displayed in the Administration section. | |
namespace | PHP namespace for module classes. | |
version | Module version. | |
type | Type of the module. For widget must be set to widget | Yes for widgets, otherwise no |
widget | Widget configuration. Used for widgets only. | |
actions | Actions to register with the module. | |
assets | CSS styles and JavaScript files to include. | No |
author | Module author. | |
config | Default values for custom module options. | |
description | Module description. | |
url | A link to the module description. |
Manifest version of the module. Currently, supported version is 2.0.
Type: Double
Example:
Module ID. Must be unique. To avoid future naming conflicts, it is recommended to use prefix for modules (author or company name, or any other). For example, if a module is an example for lessons and the module name is "My module", then the ID will be "example_my_module".
Type: String
Example:
Module name that will be displayed in the Administration section.
Type: String
Example:
PHP namespace for module classes.
Type: String
Example:
Module version. The version will be displayed in the Administration section.
Type: String
Example:
Type of the module. Required for widgets and must equal "widget".
Type: String
Default: "module"
Example:
Actions to register with the module. Defining class object key for each action is required, other action keys are optional.
Type: Object
Supported object keys if type is module:
Example:
"actions": {
"module.example.list": {
"class": "ExampleList",
"view": "example.list",
"layout": "layout.htmlpage"
}
}
Supported object keys if type is widget:
Example:
"actions": {
"widget.tophosts.view": {
"class": "WidgetView"
},
"widget.tophosts.column.edit": {
"class": "ColumnEdit",
"view": "column.edit",
"layout": "layout.json"
}
}
CSS styles and JavaScript files to include.
Type: Object
Supported object keys:
Example:
Module author. The author will be displayed in the Administration section.
Type: String
Example:
Default values for the module options. The object may contain any custom keys. If specified, these values will be written into the database during module registration. New variables added later will be written upon the first call. Afterwards, the variable values can only be changed directly in the database.
Type: Object
Example:
Module description.
Type: String
Example:
Widget configuration. Used, if type is set to widget.
Type: Object
Supported object keys:
name (string) - used in the widget list and as default header. If empty, "name" parameter from the module will be used.
template_support (boolean) - determines whether the widget should be available in template dashboards. Supported values: true, false (default).
size (object) - default widget dimensions. Supports keys:
form_class (string) - class with widget fields form. Must be located in the includes directory. If the class is WidgetForm.php, which is expected by default, this parameter maybe omitted. If using a different name, specify it here.
js_class (string) - name of a JavaScript class for widget view mode to extend the default CWidget class. The class will be loaded with the dashboard. The class source file must be located in the assets/js directory. See also: assets.
use_time_selector (boolean) - determines whether the widget requires dashboard time selector. Supported values: true, false (default).
refresh_rate (integer) - widget refresh rate in seconds (default: 60).
Example:
"widget": {
"name": "",
"template_support": true,
"size": {
"width": 12,
"height": 5
},
"form_class": "WidgetForm",
"js_class": "CWidget",
"use_time_selector": false,
"refresh_rate": 60
}
A link to the module description.
Type: String
Example: