Hiding plugin parameters in Joomla with vmconfig

Written by Valérie Isaksen on . Posted in Development

Within Joomla plugins, there are manifest files. Those manifest files have the name <extension_name>.xml . They contain general information about the installation, as well as parameters for the configuration of the plugin itself. 

In VirtueMart, those configuration parameters are used inside the component itself when creating a payment, shipment or a custom field. The values stored via the Joomla Plugin manager are not used.

Since VirtueMart 3, it is possible to hide those parameters in Joomla Plugin manager by using the tag <vmconfig>.

This is done by changing the <config>section in the plugin xml to <vmconfig>. If the plugin xml contains a <vmconfig>section, it is now used and does not appear in the Joomla plugin. If a plugin xml does not contain a <vmconfig> section, as a fallback the <config>section is used  and in this case, it WILL appear in the Joomla plugin config).

Example:

<?xml version="1.0" encoding="UTF-8" ?>
<extension version="2.5" type="plugin" group="vmshipment" method="upgrade">
    <name>By weight, ZIP and countries</name>
   ....
    <languages>
        <language tag="en-GB">en-GB.plg_vmshipment_weight_countries.ini</language>
    </languages>
    <files>
        <filename plugin="weight_countries">weight_countries.php</filename>
        <folder>weight_countries</folder>
    </files>
    <vmconfig>
        <fields name="params">
            <fieldset name="restrictions">
                <field name="show_on_pdetails" type="radio" scope="com_virtuemart" default="1"
                               label="VMSHIPMENT_WEIGHT_COUNTRIES_SHOW_ON_PRDETAILS"
                               description="VMSHIPMENT_WEIGHT_COUNTRIES_SHOW_ON_PRDETAILS_TIP">
                            <option value="0">COM_VIRTUEMART_NO</option>
                            <option value="1">COM_VIRTUEMART_YES</option>
                </field>
                .....
            </fieldset>
        </fields>
    </vmconfig>
</extension>