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!
| Labels | Added: 
? | ||
| Title | 
 | ||||||
| Title | 
 | ||||||
| Category | ⇒ | Modules | 
| Title | 
 | ||||||
| Title | 
 | ||||||
| Priority | Medium | ⇒ | Low | 
| Status | New | ⇒ | Needs Review | 
| Title | 
 | ||||||
| Labels | Added: 
J3 Issue | ||
 
                | Status | Needs Review | ⇒ | Discussion | 
| Status | Discussion | ⇒ | Confirmed | 
 
                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.
 
                Angels died today when I had to commit code to work around this issue in 3.9. Yet to test in J4.
 
                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
| 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: ? | ||
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
joomla-cms/libraries/src/MVC/Model/FormModel.php
Line 237 in 6de2b00
passing in the $data to loadForm and using it instead of creating a new blank array at
joomla-cms/libraries/src/MVC/Model/FormModel.php
Line 237 in 6de2b00
but this is not the real fix I dont think. It works but it tacky.