I have a problem when adding custom fields to the com_menus - item view.
Tutorial: (see: http://docs.joomla.org/Adding_custom_fields_to_core_components_using_a_plugin)
The tutorial works great (com_contact), but when I want to cover the menu-item view: The parameters are not being saved!!!
Below is the code that I am using to determine the component and the view for adding the custom form.
class plgContentPluginName extends JPlugin {
function onContentPrepareForm($form, $data) {
$app = JFactory::getApplication();
$option = $app->input->get('option');
$view = $app->input->get('view');
switch($option) {
case 'com_menus': {
if ($app->isAdmin() && $view == 'item') {
JForm::addFormPath(__DIR__ . '/forms');
$form->loadFile('item', false);
}
return true;
}
}
return true;
}
}
Here is the item.xml that is being loaded (/forms/item.xml)
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fields name="params">
<fieldset name="params" label="Custom Fields">
<field name="param1" type="text" label="lbltext"/>
<field name="param2" type="text" label="lblText2"/>
</fieldset>
</fields>
</form>
The form is being rendered properly when I am creating or editing a menu item, but the values are not being saved when I hit "Save".
Thanks.
NULL
is actually possible and within what the API has been created for?NULL
most often is a special value as it denotes something as "not having any value". – Haland