User tests: Successful: Unsuccessful:
The 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.
I'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 and the manifest files docs (where it doesn't state the attribute is for submenu use only).
Created 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='.
If 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.
The 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.
I 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.
The 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>.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-04-13 10:07:12 |
Closed_By | ⇒ | chrBrd |
Title |
|
Category | ⇒ | Libraries |