Closed bassmanpaul closed 2 years ago
I can replicate this and have seen this many times over the years....
Before this line $data is populated correctly
after it $data is gone.
This is because some reference something is happening here https://github.com/joomla/joomla-cms/blob/6de2b00858e91bd64e7c410a6ed617d455f62d64/libraries/src/MVC/Model/FormModel.php#L237
passing in the $data to loadForm and using it instead of creating a new blank array at https://github.com/joomla/joomla-cms/blob/6de2b00858e91bd64e7c410a6ed617d455f62d64/libraries/src/MVC/Model/FormModel.php#L237 seems to work
but this is not the real fix I dont think. It works but it tacky.
Related issue #17700 about empty $data.
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
Hi, I'm not sure if this is expected behaviour or not but when saving a module, the
$data
object inonContentPrepareForm( $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, theonContentPrepareForm()
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!