{"action":"created","issue":{"url":"https://api.github.com/repos/vdm-io/Joomla-Component-Builder/issues/383","repository_url":"https://api.github.com/repos/vdm-io/Joomla-Component-Builder","labels_url":"https://api.github.com/repos/vdm-io/Joomla-Component-Builder/issues/383/labels{/name}","comments_url":"https://api.github.com/repos/vdm-io/Joomla-Component-Builder/issues/383/comments","events_url":"https://api.github.com/repos/vdm-io/Joomla-Component-Builder/issues/383/events","html_url":"https://github.com/vdm-io/Joomla-Component-Builder/issues/383","id":415073126,"node_id":"MDU6SXNzdWU0MTUwNzMxMjY=","number":383,"title":"Issue with 'New' button on child tab of parent/child frontend edit form with SEF enabled","user":{"login":"pjdevries","id":1171835,"node_id":"MDQ6VXNlcjExNzE4MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/1171835?v=4","gravatar_id":"","url":"https://api.github.com/users/pjdevries","html_url":"https://github.com/pjdevries","followers_url":"https://api.github.com/users/pjdevries/followers","following_url":"https://api.github.com/users/pjdevries/following{/other_user}","gists_url":"https://api.github.com/users/pjdevries/gists{/gist_id}","starred_url":"https://api.github.com/users/pjdevries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjdevries/subscriptions","organizations_url":"https://api.github.com/users/pjdevries/orgs","repos_url":"https://api.github.com/users/pjdevries/repos","events_url":"https://api.github.com/users/pjdevries/events{/privacy}","received_events_url":"https://api.github.com/users/pjdevries/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-02-27T11:17:28Z","updated_at":"2019-03-03T15:21:46Z","closed_at":null,"author_association":"NONE","body":"First of all I want to thank  Llewellyn for the time and effort he put into JCB and making it available for free to the community.\r\n\r\nNow let me report the first issue I encountered. I have a simple project, with two tables in a parent/child relationship. Following the video's, I created various admin views. The admin view for the parent table has a tab showing the child records, allowing new records to be added and existing records to be edited. Works like a charm :)\r\n\r\nI also had JCB create the frontend edit logic. Again following the appropriate video's, I created the necessary custom code to show the associate views in the frontend. Also works like a charm, except for one thing: the **New** button on the child tab does not work as expected. It does with SEF *disabled* but not when SEF is *enabled*. **Edit** links work in both cases though. \r\n\r\nBecause the Joomla! router is not exactly my strong suite, I had to spend quite a bit of time trying to figure out what's wrong :) Eventually I traced it back to this piece of code in the `build` method of generated component's `router.php`:\r\n```php\r\n\t\tif (isset($query[`view`]))\r\n\t\t{\r\n\t\t\t$view = $query[`view`];\r\n\r\n\t\t\tif (empty($query['Itemid']))\r\n\t\t\t{\r\n\t\t\t\t$segments[] = $query[`view`];\r\n\t\t\t}\r\n\r\n\t\t\tunset($query[`view`]);\r\n\t\t}\r\n```\r\nThe second `if` results in the `view` parameter being removed from the resulting uri. The assumption seems to be that the `view` parameter is not needed when the `Itemid` is known. That the Joomla! router can deduce the correct view from that `Itemid`. Apparently that's not the cases in parent/child forms.  \r\n\r\nAlthough having a `view` parameter might be overkill in some or even most cases, I figured it can do no harm when it's always there. So I removed the second `if` resulting the **New** button to work as expected. The other views also seem to do their thing without noticeable issues, \r\nso this might be a proper solution.\r\n\r\nRegards,\r\n\r\nPieter-jan de Vries\r\n"},"comment":{"url":"https://api.github.com/repos/vdm-io/Joomla-Component-Builder/issues/comments/469032971","html_url":"https://github.com/vdm-io/Joomla-Component-Builder/issues/383#issuecomment-469032971","issue_url":"https://api.github.com/repos/vdm-io/Joomla-Component-Builder/issues/383","id":469032971,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2OTAzMjk3MQ==","user":{"login":"Llewellynvdm","id":5607939,"node_id":"MDQ6VXNlcjU2MDc5Mzk=","avatar_url":"https://avatars3.githubusercontent.com/u/5607939?v=4","gravatar_id":"","url":"https://api.github.com/users/Llewellynvdm","html_url":"https://github.com/Llewellynvdm","followers_url":"https://api.github.com/users/Llewellynvdm/followers","following_url":"https://api.github.com/users/Llewellynvdm/following{/other_user}","gists_url":"https://api.github.com/users/Llewellynvdm/gists{/gist_id}","starred_url":"https://api.github.com/users/Llewellynvdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Llewellynvdm/subscriptions","organizations_url":"https://api.github.com/users/Llewellynvdm/orgs","repos_url":"https://api.github.com/users/Llewellynvdm/repos","events_url":"https://api.github.com/users/Llewellynvdm/events{/privacy}","received_events_url":"https://api.github.com/users/Llewellynvdm/received_events","type":"User","site_admin":false},"created_at":"2019-03-03T15:21:46Z","updated_at":"2019-03-03T15:21:46Z","author_association":"MEMBER","body":"ahh I get it... okay let me check it out you are not taking about custom scripting... sorry I missed that. Give me a moment and I will investigate. "}}
{"actor":{"display_login":"Llewellynvdm"}}