{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/7099","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/7099/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/7099/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/7099/events","html_url":"https://github.com/joomla/joomla-cms/pull/7099","id":84266808,"number":7099,"title":"Override module chrome with a plugin","user":{"login":"jrseliga","id":3277067,"avatar_url":"https://avatars.githubusercontent.com/u/3277067?v=3","gravatar_id":"","url":"https://api.github.com/users/jrseliga","html_url":"https://github.com/jrseliga","followers_url":"https://api.github.com/users/jrseliga/followers","following_url":"https://api.github.com/users/jrseliga/following{/other_user}","gists_url":"https://api.github.com/users/jrseliga/gists{/gist_id}","starred_url":"https://api.github.com/users/jrseliga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrseliga/subscriptions","organizations_url":"https://api.github.com/users/jrseliga/orgs","repos_url":"https://api.github.com/users/jrseliga/repos","events_url":"https://api.github.com/users/jrseliga/events{/privacy}","received_events_url":"https://api.github.com/users/jrseliga/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-06-02T23:45:39Z","updated_at":"2015-06-09T13:01:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/7099","html_url":"https://github.com/joomla/joomla-cms/pull/7099","diff_url":"https://github.com/joomla/joomla-cms/pull/7099.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/7099.patch"},"body":"#### Purpose\r\nTemplate providers often ship the same module chromes with every template. It is much more convenient to manage one file and ship a plugin or a plugin + library that could register these module chromes.\r\n\r\nUnfortunately a popular template framework provider already implements this concept by overriding\r\nthe core file /libraries/cms/module/helper.php with their framework initialization plugin for the purposes of adding their own triggerEvent.\r\n\r\n#### How it works\r\nA plugin that executes on the **onGetModuleChromes** must return an array with keys **element** (friendly name for their list of module chromes) and **path** (path to file containing module chrome definitions)\r\n\r\n#### Testing\r\n1. Install Joomla (sample data not necessary)\r\n2. [Upload plugin folders to /plugins/system] (https://github.com/jrseliga/module-chrome-plugins) \r\n3. Discover / Enable plugins **modulechromesone** and **modulechromestwo**\r\n4. Navigate to front-end notice the \"Login Form\" module\r\n![default-install](https://cloud.githubusercontent.com/assets/3277067/8049245/bc724da0-0e2a-11e5-966c-2700b522c0d0.png)\r\n5. Module Manager\r\n  - Login Form\r\n    1. Advanced tab\r\n    2. Module Style\r\n      - Scroll to bottom, will see two new grouped lists **Plugin One** and **Plugin Two**\r\n   ![module-style](https://cloud.githubusercontent.com/assets/3277067/8049249/c522ed10-0e2a-11e5-8b4f-0a4e052cc833.png)\r\n    3. Choose any from either of these groups\r\n    4. Refresh front-end, the name of the module chrome function used will be displayed in place of the log in form.![one](https://cloud.githubusercontent.com/assets/3277067/8049264/f90ebaf0-0e2a-11e5-915a-0175693a933f.png)\r\n    5. Repeat last two steps to see different chromes rendered. ![four](https://cloud.githubusercontent.com/assets/3277067/8049255/dcae7daa-0e2a-11e5-944a-d0ed79fc135a.png)\r\n"},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/110350453","html_url":"https://github.com/joomla/joomla-cms/pull/7099#issuecomment-110350453","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/7099","id":110350453,"user":{"login":"jrseliga","id":3277067,"avatar_url":"https://avatars.githubusercontent.com/u/3277067?v=3","gravatar_id":"","url":"https://api.github.com/users/jrseliga","html_url":"https://github.com/jrseliga","followers_url":"https://api.github.com/users/jrseliga/followers","following_url":"https://api.github.com/users/jrseliga/following{/other_user}","gists_url":"https://api.github.com/users/jrseliga/gists{/gist_id}","starred_url":"https://api.github.com/users/jrseliga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrseliga/subscriptions","organizations_url":"https://api.github.com/users/jrseliga/orgs","repos_url":"https://api.github.com/users/jrseliga/repos","events_url":"https://api.github.com/users/jrseliga/events{/privacy}","received_events_url":"https://api.github.com/users/jrseliga/received_events","type":"User","site_admin":false},"created_at":"2015-06-09T13:01:46Z","updated_at":"2015-06-09T13:01:46Z","body":"@phproberto would like to see this available in 3.5 and would be happy to help implement the concept with `JLayout`."}}