Documentation

Manifests

Overview

All modules should include a manifest in the form of an XML document named the same as the module. The file holds key "metadata" about the module.

Note: All modules must be prefixed with mod_.

Directory Structure & Files

Manifests are stored in the same directory as the module file itself and must be named the same (the file extension being the obvious difference).

/hubzero
  /modules
    /{ModuleName}
      /tmpl
        default.php
      helper.php
      mod_{ModuleName}.php
      mod_{ModuleName}.xml

Structure

This XML file just lines out basic information about the template such as the owner, version, etc. for identification by the Joomla! 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.5.0">
	<!-- Name of the Module -->
	<name>Hello World - Hello</name> 

	<!-- Name of the Author -->
	<author>Ambitionality Software LLC</author> 

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

	<!-- Copyright information -->
	<copyright>All rights reserved by Ambitionality Software LLC 2008.</copyright> 

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

	<!-- Author's email address -->
	<authorEmail>info@ambitionality.com</authorEmail> 

	<!-- Author's website -->
	<authorUrl>www.ambitionality.com</authorUrl> 

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

	<!-- Description of what the module does -->
	<description>Outputs a random list of user names</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>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="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />

				<!-- 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="LABEL USER COUNT" description="DESC USER COUNT" />
			</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®