Skip to content

External Module Developers

Richard Dooley edited this page Jul 15, 2025 · 1 revision

The Project Deployment module will include external module project settings from all external modules enabled for a project in the Project Object and it will compare these settings when checking for changes. By default, all the project settings which are specified in each module's config.json file are included. If a setting is of type arm-list, event-list, project-id or user-role-list, then the values will be converted to arm numbers, unique event names, project names and user role labels repectively. If a setting is of type dag-list or file it will not be included.

Sometimes a module developer may wish to amend the settings which are presented to the Project Deployment module or provide an entirely different set of setting values. This may be because it is desirable to exclude some settings from export, perhaps because they contain sensitive data or because the setting is expected to differ between copies of a project. Alternately the settings might not be in a format that facilitates easy manual comparison in the Project Object and reformatting the settings may be desirable.

To provide a custom settings export for the Project Deployment module (and other modules which read module settings), an exportProjectSettings function can be defined in the module. This function must accept the project ID as a parameter and should output data in one of two formats:

Format 1: An array of arrays, where each inner array contains the keys key and value (and optionally type)

[
  [ 'key' => 'some-key-name-here', 'value' => 'A setting value here' ],
  [ 'key' => 'another-key-name-here', 'value' => 'Another setting value here' ],
  [ 'key' => 'a-boolean-setting', 'value' => 'true', 'type' => 'boolean' ],
  ...
]

If using this format, the values are expected to be provided as strings. If they need to be interpreted as other types use the type key.

If the optional type key is used, it must be one of: boolean (for true/false values), integer (whole number values) or json / json-array (either will be interpreted as JSON data). If a different type is given or if a type is not specified it will be interpreted as text.

Format 2: An array of keys and values

[
  'some-key-name-here' => 'A setting value here',
  'another-key-name-here' => 'Another setting value here',
  'a-boolean-setting' => true,
  ...
]

If using this format, the values are expected to be provided as the appropriate data type. You will need to convert values to the appropriate type yourself. JSON values can be converted into PHP arrays with the json_decode function.

Clone this wiki locally