{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/14851","repository_url":"https://api.github.com/repos/joomla/joomla-cms","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/14851/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/14851/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/14851/events","html_url":"https://github.com/joomla/joomla-cms/issues/14851","id":215984700,"number":14851,"title":"onContentPrepareForm event $data is unpopulated","user":{"login":"bassmanpaul","id":6650331,"avatar_url":"https://avatars3.githubusercontent.com/u/6650331?v=4","gravatar_id":"","url":"https://api.github.com/users/bassmanpaul","html_url":"https://github.com/bassmanpaul","followers_url":"https://api.github.com/users/bassmanpaul/followers","following_url":"https://api.github.com/users/bassmanpaul/following{/other_user}","gists_url":"https://api.github.com/users/bassmanpaul/gists{/gist_id}","starred_url":"https://api.github.com/users/bassmanpaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bassmanpaul/subscriptions","organizations_url":"https://api.github.com/users/bassmanpaul/orgs","repos_url":"https://api.github.com/users/bassmanpaul/repos","events_url":"https://api.github.com/users/bassmanpaul/events{/privacy}","received_events_url":"https://api.github.com/users/bassmanpaul/received_events","type":"User","site_admin":false},"labels":[{"id":878880561,"url":"https://api.github.com/repos/joomla/joomla-cms/labels/J3%20Issue","name":"J3 Issue","color":"bc8503","default":false},{"id":138443932,"url":"https://api.github.com/repos/joomla/joomla-cms/labels/No%20Code%20Attached%20Yet","name":"No Code Attached Yet","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-22T08:18:30Z","updated_at":"2018-05-16T00:59:52Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"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.\r\n\r\nMy 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.\r\n\r\nUnfortunately, the `$data` is unpopulated on save. Is this intended?\r\n\r\nI'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.\r\n\r\nThoughts welcome!\r\n"},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/389361199","html_url":"https://github.com/joomla/joomla-cms/issues/14851#issuecomment-389361199","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/14851","id":389361199,"user":{"login":"PhilETaylor","id":400092,"avatar_url":"https://avatars1.githubusercontent.com/u/400092?v=4","gravatar_id":"","url":"https://api.github.com/users/PhilETaylor","html_url":"https://github.com/PhilETaylor","followers_url":"https://api.github.com/users/PhilETaylor/followers","following_url":"https://api.github.com/users/PhilETaylor/following{/other_user}","gists_url":"https://api.github.com/users/PhilETaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/PhilETaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhilETaylor/subscriptions","organizations_url":"https://api.github.com/users/PhilETaylor/orgs","repos_url":"https://api.github.com/users/PhilETaylor/repos","events_url":"https://api.github.com/users/PhilETaylor/events{/privacy}","received_events_url":"https://api.github.com/users/PhilETaylor/received_events","type":"User","site_admin":false},"created_at":"2018-05-16T00:59:52Z","updated_at":"2018-05-16T00:59:52Z","author_association":"CONTRIBUTOR","body":"I can replicate this and have seen this many times over the years....\r\n\r\nBefore this line $data is populated correctly\r\n\r\nhttps://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_modules/models/module.php#L553\r\n\r\nafter it $data is gone.\r\n\r\nThis is because some reference something is happening here https://github.com/joomla/joomla-cms/blob/6de2b00858e91bd64e7c410a6ed617d455f62d64/libraries/src/MVC/Model/FormModel.php#L237\r\n\r\npassing 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\r\n\r\nbut this is not the real fix I dont think. It works but it tacky. "}}
{"actor":{"display_login":"PhilETaylor"}}