Documentation

Packaging

Overview

Packaging a module for distribution is easy. Just "zip" up the module directory into a compressed archive file. When the ZIP file is installed, the files are copied to the /app/modules/{ModuleName} subfolder of the installation.

Manifest

All modules should include a manifest in the form of an XML document named the same as the module. This file lines out basic information about the module such as the owner, version, etc. for identification by the installer and then provides optional parameters which may be set in the Module Manager and accessed from within the module's logic to fine tune its behavior. Additionally, this file tells the installer which files should be copied and installed.

A typical module manifest:

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="1.0.0">
	<!-- Name of the Module -->
	<name>mod_listnames</name> 

	<!-- Name of the Author -->
	<author>HUBzero</author> 

	<!-- Version Date of the Module -->
	<creationDate>2015-06-23</creationDate> 

	<!-- Copyright information -->
	<copyright>All rights reserved by HUBzero 2015.</copyright> 

	<!-- License Information -->
	<license>GPL 2.0</license> 

	<!-- Author's email address -->
	<authorEmail>support@hubzero.org</authorEmail> 

	<!-- Author's website -->
	<authorUrl>hubzero.org</authorUrl> 

	<!-- Module version number -->
	<version>1.0.0</version> 

	<!-- Description of what the module does -->
	<description>MOD_LISTNAMES_DESCRIPTION</description>

	<!-- Listing of all files that should be installed for the module to function -->
	<files>
		<!-- The "module" attribute signifies that this is the main controller file -->
		<filename module="mod_listnames">mod_listnames.php</filename>
		<filename>index.html</filename>
		<filename>helper.php</filename>
		<filename>tmpl/default.php</filename>
		<filename>tmpl/index.html</filename>
	</files>
	
	<languages>
		<!-- Any language files included with the module -->
		<language tag="en-GB">en-GB.mod_listnames.ini</language>
	</languages>
	
	<!-- Optional parameters -->
	<config>
		<fields name="params">
			<fieldsset name="basic">
				<!-- parameter to allow placement of a module class suffix for the module table / xhtml display -->
				<field name="moduleclass_sfx" type="text" default="" label="MOD_LISTNAMES_PARAM_CLASS_LABEL" description="MOD_LISTNAMES_PARAM_CLASS_DESC" />

				<!-- just gives us a little room between the previous paramter and the next -->
				<field name="@spacer" type="spacer" default="" label="" description="" />

				<!-- A parameter that allows an administrator to modify the number of users that this module will display -->
				<field name="usercount" type="text" default="5" label="MOD_LISTNAMES_PARAM_USERCOUNT_LABEL" description="MOD_LISTNAMES_PARAM_USERCOUNT_DESC" />
			</fieldset>
		</fields>
	<config>
</extension>

Note: Notice that we DO NOT include a reference in the files section for the XML file.

Let's go through some of the most important tags:

EXTENSION
The extension tag has several key attributes. The type must be "module".
NAME
You can name the module in any way you wish.
FILES
The files tag includes all of the files that will will be installed with the module.
CONFIG
Any number of parameters can be specified for a module.

Last modified:

  • Copyright © 2022 Hubzero
  • Powered by Hubzero®