{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/9892","repository_url":"https://api.github.com/repos/joomla/joomla-cms","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9892/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9892/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9892/events","html_url":"https://github.com/joomla/joomla-cms/pull/9892","id":148031149,"number":9892,"title":"Fix for admin menu link attribute in component manifest doing nothing","user":{"login":"chrBrd","id":16094329,"avatar_url":"https://avatars.githubusercontent.com/u/16094329?v=3","gravatar_id":"","url":"https://api.github.com/users/chrBrd","html_url":"https://github.com/chrBrd","followers_url":"https://api.github.com/users/chrBrd/followers","following_url":"https://api.github.com/users/chrBrd/following{/other_user}","gists_url":"https://api.github.com/users/chrBrd/gists{/gist_id}","starred_url":"https://api.github.com/users/chrBrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrBrd/subscriptions","organizations_url":"https://api.github.com/users/chrBrd/orgs","repos_url":"https://api.github.com/users/chrBrd/repos","events_url":"https://api.github.com/users/chrBrd/events{/privacy}","received_events_url":"https://api.github.com/users/chrBrd/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":1,"created_at":"2016-04-13T11:35:23Z","updated_at":"2016-04-13T11:47:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/9892","html_url":"https://github.com/joomla/joomla-cms/pull/9892","diff_url":"https://github.com/joomla/joomla-cms/pull/9892.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/9892.patch"},"body":"#### Issue\r\n\r\nThe link attribute in the parent administrator \\<menu\\> element of a component XML manifest is currently completely ignored on installation; it isn't used anywhere. Instead the link is built using a value derived from the undocumented, therefore typically not present, \\<element\\> element. As there is usually not a value set for this it defaults to using the component's \\<name\\>, causing issues if you want to have the component named slightly differently from any desired URLs.\r\n\r\nI'm assuming the link attribute should do something on parent menus, as it's included in all the core component manifests, as well as the 3.x MVC Component [tutorial](https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_a_menu_type_to_the_site_part) and the manifest files [docs](https://docs.joomla.org/Manifest_files#Menu_links_and_submenus) (where it doesn't state the attribute is for submenu use only).\r\n\r\n#### Summary of Changes\r\n\r\nCreated a new method, getMenuLinkOption(), in JInstallerAdapter. This is executed in the getElement() method in the same class. If the admin menu element's link attribute is set it returns a filtered string matching all text after 'option='.\r\n\r\nIf a string is returned it becomes the extension's element attribute, otherwise the element value defaults to the \\<name\\> element from the manifest as usual.\r\n\r\n#### Testing Instructions\r\n\r\n- Download the MVC Component tutorial [archive](https://github.com/scionescire/Joomla-3.2-Hello-World-Component/archive/step-3-adding-a-site-menu.zip).\r\n- In the component's XML manifest file change value of the \\<name\\> element to 'Simple Hello World Component'.\r\n- Install the component\r\n\r\nThe link to the component in the administrator menu will still work, but the component's name in the extension manager will be 'Simple Hello World Component'. Submenus are linked properly too.\r\n\r\n#### Additional Comments\r\n\r\nI originally started out changing _buildAdminMenus in JInstallerAdapterComponent. The $option variable used to build all the admin menu links is the value of the manifest's \\<element\\> element. This isn't set in any XML manifest I've found and the only reference to it in the code is in the JUpdate class where it doesn't seem to do anything.  Rather than modifying _buildAdminMenus, it was far neater to create a new method in JInstallerAdapter and set the element to the menu link's option. Setting the element attribute this way seems to make more sense given what it's used for anyway. \r\n\r\nThe new method maintains compatibility should anyone have used \\<element\\> in a manifest. It will also function as normal and default to the \\<name\\> element's value if a menu link is not set. If the link attribute's option is changed without a clean install of the component you'll get the same errors you would by changing the component's \\<name\\>."},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/209387598","html_url":"https://github.com/joomla/joomla-cms/pull/9892#issuecomment-209387598","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9892","id":209387598,"user":{"login":"brianteeman","id":1296369,"avatar_url":"https://avatars.githubusercontent.com/u/1296369?v=3","gravatar_id":"","url":"https://api.github.com/users/brianteeman","html_url":"https://github.com/brianteeman","followers_url":"https://api.github.com/users/brianteeman/followers","following_url":"https://api.github.com/users/brianteeman/following{/other_user}","gists_url":"https://api.github.com/users/brianteeman/gists{/gist_id}","starred_url":"https://api.github.com/users/brianteeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianteeman/subscriptions","organizations_url":"https://api.github.com/users/brianteeman/orgs","repos_url":"https://api.github.com/users/brianteeman/repos","events_url":"https://api.github.com/users/brianteeman/events{/privacy}","received_events_url":"https://api.github.com/users/brianteeman/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T11:47:27Z","updated_at":"2016-04-13T11:47:27Z","body":"I m a little confused by your initial comments so I went to look at the first component I could find which was JCE\r\n\r\nThis has a line in the xml\r\n > <menu view=\"cpanel\" img=\"components/com_jce/media/img/menu/logo.png\" link=\"option=com_jce\">JCE</menu>\r\n\r\nWhich if I understand you correctly you are saying is completely ignored by Joomla during installation and the link is generated by some \\<element>\r\n\r\nAs there is no \\<element> in JCE I wondered where the menu is coming from if as you say the \\<menu> element is ignored. So to test I deleted that line from the xml and installed JCE. Guess what - no admin menu. My only conclusion is that the \\<menu> element is working as documented - or am i missing something"}}