
Elgg plugins are required to have a manifest.xml file in the root of a plugin. This file contains information about the plugin like author and version. The format of this file changed between Elgg 1.7 and 1.8.
Contents |
The manifest.xml file in Elgg 1.8 includes information about the plugin itself, requirements to run the plugin, and optional information including where to display the plugin in the admin area and what APIs the plugin provides.
The manifest file is a standard XML file in UTF-8. Everything is a child of the "plugin_manifest" element. It is important to specify the correct XML Namespace on this element to signify which manifest format you're using. For plugins development in 1.8, use the namespace: http://www.elgg.org/plugin_manifest/1.8.
<?xml version="1.0" encoding="UTF-8" ?> <plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
In Elgg 1.8 the manifest syntax is as follows:
<name>value</name>
Many elements can contain children attributes:
<parent_name> <child_name>value</child_name> <child_name_2>value_2</child_name_2> </parent_name>
All plugins are required to define the following elements in their manifest files:
In addition to the require elements above, the follow elements are available to use:
This manifest file is the bare minimum a plugin must have.
<?xml version="1.0" encoding="UTF-8"?> <plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8"> <name>Example Manifest</name> <author>Elgg</author> <version>1.0</version> <description>This is a simple example of a manifest file. In this example, there are not screenshots, dependencies, or additional information about the plugin.</description> <requires> <type>elgg_release</type> <version>1.8</version> </requires> </plugin_manifest>
This example uses all of the available elements:
<?xml version="1.0" encoding="UTF-8"?> <plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8"> <name>Example Manifest</name> <author>Brett Profitt</author> <version>1.0</version> <blurb>This is an example manifest file.</blurb> <description>This is a simple example of a manifest file. In this example, there are many options used, including screenshots, dependencies, and additional information about the plugin.</description> <website>http://www.elgg.org/</website> <copyright>(C) Brett Profitt 2011</copyright> <license>GNU Public License version 2</license> <category>3rd_party_integration</category> <!-- All plugins must require either elgg_version or elgg_release. --> <requires> <type>elgg_version</type> <version>2011010401</version> </requires> <!-- The path is relative to the plugin's root. --> <screenshot> <description>Elgg profile.</description> <path>screenshots/profile.png</path> </screenshot> <provides> <type>plugin</type> <name>example_plugin</name> <version>1.8</version> </provides> <suggests> <type>plugin</type> <name>twitter</name> <version>1.0</version> </suggests> </plugin_manifest>
In Elgg 1.7 and below, manifest.xml uses a different syntax. This format is deprecated as of Elgg 1.8. Though Elgg 1.8 still supports this syntax, many options are unavailable if you choose not to use the 1.8 manifest syntax.
The deprecated manifest.xml file uses the attributes from self-closing 'field' elements to specify keys and values:
<field key="name" value="value" />The following are the only keys supported in the deprecated manifest:
<?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> <field key="author" value="Marcus Povey" /> <field key="version" value="1.0" /> <field key="description" value="Provide a list of your or your friends recent activity!" /> <field key="website" value="http://www.elgg.org/" /> <field key="copyright" value="(C) Curverider 2008" /> <field key="licence" value="GNU Public License version 2" /> </plugin_manifest>
A plugin author may specify a minimum version of Elgg core required to run their plugin using:
<field key="elgg_version" value="YYYYMMDDVV" />Where YYYYMMDDVV is the contents of the $version variable in version.php, eg: 2009021501.
To update your manifest files to 1.8, download and run the manifest_update_18.php script at https://github.com/brettp/elgg-plugin-migration-tools
Alternatively, you can run this series of regular expression find/replace:
You will then have to manually add the "<name>My Plugin</name>" field. That's it!