I've created a plugin and added a couple of custom fields to its backend. For that I followed the indications from the Joomla docs. I extended for example JFormFieldList
to get a dropdown list of options.
My fields work fine if the plugin is enabled. But when the plugin is disabled, the list is not rendered. I get just a basic text box.
Same problem with another custom field that should display a button. The button appears if the plugin is enabled but if it’s disabled, I get the same basic text box instead.
I assume therefore that the problem is that the php of the custom fields is not run when the plugin is disabled. Is there a way around that?
EDIT: here’s one of my custom fields
<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
jimport('joomla.form.formfield');
class JFormFieldZotcslLocales extends JFormFieldList
{
protected $type = 'ZotcslLocales';
public function getOptions() {
$path = JPATH_ROOT.'/media/plg_zotbib/locales/*.xml';
foreach(glob($path) as $file){
$name = basename($file, '.xml');
$name = str_replace('locales-', '', $name);
$locales[$name] = $name;
}
return $locales;
}
}
?>
And here’s how it’s included in the manifest file
<field name="locale" type="zotcsllocales"
description="PLG_ZOTBIB_LOCALE_DESC"
label="PLG_ZOTBIB_LOCALE_LABEL"
required="true"
/>