From Joomla! Documentation

Revision as of 09:50, 24 August 2012 by E-builds (Talk | contribs)

Note on component dependant modules

Sometimes modules (or plugins etc.) use a component's models and helpers and such. In these occasions it would be nice to be able to package your module in this way that it gets uninstalled when the component itself gets uninstalled. This is called dependency management which has been desired in joomla but hasn't been done yet. It is suggested to follow the standards and just using a package as is described below.

What is a package?

A package is a extension that is used to install multiple extensions in one go. This is used if you have for example a component and a module that are depending on each other. Combining them in a package will let the user install and uninstall both extensions in one go. Package extensions can be used with Joomla Compat icon 1 6.png and higher.

How do I create a package?

A package extension is created by zipping all zip files of the extensions together with a xml manifest file. For example if you have a package composed by:

  • component helloworld
  • module helloworld
  • library helloworld
  • system plugin helloworld
  • template helloworld

The package should have the following tree in your zipfile:

 -- pkg_helloworld.xml
 -- packages <dir>

The pkg_helloworld.xml could have the following contents:

 <?xml version="1.0" encoding="UTF-8" ?>
 <extension type="package" version="1.6">
 <name>Hello World Package</name>
 <author>Hello World Package Team</author>
 <creationDate>May 2012</creationDate>
 <packager>Hello World Package Team</packager>
 <description>Example package to combine multiple extensions</description>
 <files folder="packages">
   <file type="component" id="helloworld" ></file>
   <file type="module" id="helloworld" client="site"></file>
   <file type="library" id="helloworld"></file>
   <file type="plugin" id="helloworld" group="system"></file>
   <file type="template" id="helloworld" client="site"></file>

When you zip this and try to install it, you will see that every extension will be installed. Also the package will be visible in the extension list to uninstall all the extension of this package.

Remember to use the package uninstaller instead of individual subpackage uninstallers to avoid orphan extension entries in the extension manager.