Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding custom fields to all menu items via plugin - params not saved #5289

Closed
RANSoftRA opened this issue Dec 2, 2014 · 4 comments
Closed

Comments

@RANSoftRA
Copy link

Steps to reproduce the issue

  1. Install the Plugin - Awailable on GitHub
    (https://github.com/rainerangermeier/joomla_issues/blob/master/plugins/menuitemlogo.zip)
  2. Enable the Plugin in the Extensions/Plugin Manager (name = plg_menuitemlogo)
  3. Open some menu Item in the Menu Manager
  4. Select Tab "Custom Params"
  5. Select some image from the image folder of your Joomla installation
  6. Hit save

Expected result

A new "logo" variable was added to the menu item's params column (table #__menu) - having the value of the image path you selected. (image path stored in params column)

The image path should be displayed in the Custom Params / Logo Image media field, when you open the menu item.

Actual result

The logo parameter is not being saved in the database.
The image path is not being displayed in the Custom Params / Logo Image media field.

System information (as much as possible)

XAMPP Control Panel v3.2.1
PHP: 5.5.6
MySQL: 5.6.14
OS: Windows 8.1 Professional
Joomla: 3.3.6

Additional comments

I followed the tutorial for "Adding custom fields to core components using a plugin"
http://docs.joomla.org/Adding_custom_fields_to_core_components_using_a_plugin "Adding custom fields to core components using a plugin

This tutorial works perfectly, but not when I am trying to adapt it for com_menus.item component.

There is already a StackOverflow Question that explains all of this:

http://stackoverflow.com/questions/25832262/joomla-3-3-adding-custom-fields-to-all-menu-items-via-plugin-params-not-save

@big-wave-tim
Copy link
Contributor

Hi

I think this maybe a problem with how you implemented your plugin rather than Joomla! itself.

Perhaps have a look at plugins/user/profile as I know this saves additional info into the database.

I think your plugin only has the code to show a custom field and lacks code to act upon anything that the user adds to the field. specifically I think you need to do more than override onContentPrepareForm you need to tell Joomla! what to do when the form is saved to.

@Hackwar
Copy link
Member

Hackwar commented Dec 4, 2014

That is indeed an issue of your plugin. You are correctly extending the form with that event and that is enough to save it also in the params field in the database, but you are checking against the request parameters and expect it to be a view. When saving the data, there is no view request parameter, instead its done via task=item.save. That said, the request parameters are not reliable for that check. Instead please check against the name of the form. This is not a Joomla bug. Closing.

@jissues-bot
Copy link

Set to "closed" on behalf of @Hackwar by The JTracker Application at issues.joomla.org/joomla-cms/5289

@aaronhudon
Copy link

Can someone please describe what is required to make this work. I have also encountered this issue, and from what I have traced, the method "findFieldsByGroup" in JForm throws out xml nodes that are added at runtime.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5289.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants