No Code Attached Yet J3 Issue
avatar bassmanpaul
bassmanpaul
22 Mar 2017

Hi, I'm not sure if this is expected behaviour or not but when saving a module, the $data object in onContentPrepareForm( $form, $data ); is a blank array.

My content plugin needs to add additional fields to the $form based on the type of module which can be found in $data->module (e.g. 'mod_menu'). To do this, the onContentPrepareForm() fires on load and on save where I must bind my fields in both cases.

Unfortunately, the $data is unpopulated on save. Is this intended?

I've found another instance of this cropping up a few years back: https://developer.joomla.org/joomlacode-archive/issue-29145.html but a workaround was suggested rather than the issue being directly addressed/fixed.

Thoughts welcome!

avatar bassmanpaul bassmanpaul - open - 22 Mar 2017
avatar joomla-cms-bot joomla-cms-bot - change - 22 Mar 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 22 Mar 2017
avatar bassmanpaul bassmanpaul - edited - 22 Mar 2017
avatar bassmanpaul bassmanpaul - change - 22 Mar 2017
Title
onContentPrepareForm event $data is empty
onContentPrepareForm event $data is unpopulated
avatar joomla-cms-bot joomla-cms-bot - change - 22 Mar 2017
Title
onContentPrepareForm event $data is empty
onContentPrepareForm event $data is unpopulated
avatar joomla-cms-bot joomla-cms-bot - edited - 22 Mar 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Mar 2017
Category Modules
avatar joomla-cms-bot joomla-cms-bot - change - 30 Mar 2017
Title
onContentPrepareForm event $data is unpopulated
onContentPrepareForm event $data is empty
avatar joomla-cms-bot joomla-cms-bot - edited - 30 Mar 2017
avatar joomla-cms-bot joomla-cms-bot - change - 30 Mar 2017
Title
onContentPrepareForm event $data is unpopulated
onContentPrepareForm event $data is empty
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Apr 2017
Priority Medium Low
Status New Needs Review
avatar joomla-cms-bot joomla-cms-bot - change - 2 Apr 2017
Title
onContentPrepareForm event $data is empty
onContentPrepareForm event $data is unpopulated
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar PhilETaylor
PhilETaylor - comment - 16 May 2018

I can replicate this and have seen this many times over the years....

Before this line $data is populated correctly

https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_modules/models/module.php#L553

after it $data is gone.

This is because some reference something is happening here

passing in the $data to loadForm and using it instead of creating a new blank array at

seems to work

but this is not the real fix I dont think. It works but it tacky.

avatar franz-wohlkoenig franz-wohlkoenig - change - 16 May 2018
Status Needs Review Discussion
avatar Quy
Quy - comment - 10 Jun 2018

Related issue #17700 about empty $data.

avatar jwaisner jwaisner - change - 13 Mar 2020
Status Discussion Confirmed
avatar ReLater
ReLater - comment - 14 Mar 2020

I'd say that it would be a B\C break to change that behavior in J!3. For me it's sometimes a welcome behavior to identify if form loading/preparing is on/after saving or not. But I'm just a dilettante and can't judge if it's a bug.

avatar grantg182
grantg182 - comment - 12 Sep 2021

Angels died today when I had to commit code to work around this issue in 3.9. Yet to test in J4.

avatar brianteeman
brianteeman - comment - 23 Aug 2022

Thank you for raising this issue.

Joomla 3 is now in security only mode with no further bug fixes or new features.

As this issue doesn't relate to Joomla 4 it will now been closed.

If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4.
cc @zero-24

avatar zero-24 zero-24 - change - 23 Aug 2022
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2022-08-23 13:50:03
Closed_By zero-24
Labels Added: No Code Attached Yet
Removed: ?
avatar zero-24 zero-24 - close - 23 Aug 2022

Add a Comment

Login with GitHub to post a comment