Joomla 3.3 - Adding custom fields to all menu items via plugin - params not saved



I have a problem when adding custom fields to the com_menus - item view.


Tutorial: (see: http://ift.tt/1jpQJun)


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.


No comments:

Post a Comment