? Pending

User tests: Successful: Unsuccessful:

avatar chrBrd
chrBrd
12 Apr 2016

Issue

The link attribute in the parent administrator <menu> tag 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> attribute. 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).

Summary of Changes

Created a new method, getMenuLinkOption(), in JInstallerAdapter. This is executed in the getElement() method in the same class. If the admin menu's link attribute is set it returns a filtered string matching all text after 'option=' in the manifest's parent <menu> tag.

If a string is returned it becomes the extension's element attribute, otherwise the element value defaults to the <name> attribute from the manifest as usual.

Testing Instructions

  • Download the MVC Component tutorial archive.
  • In the component's XML manifest file change the <name> attribute to 'Simple Hello World Component'.
  • Install the component

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.

Additional Comments

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> attribute. 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> tags in a manifest. It will also function as normal and default to the <name> attribute 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> attribute.

avatar chrBrd chrBrd - open - 12 Apr 2016
avatar chrBrd chrBrd - change - 12 Apr 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Apr 2016
Labels Added: ?
avatar chrBrd chrBrd - change - 12 Apr 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-04-12 23:10:48
Closed_By chrBrd
avatar chrBrd chrBrd - close - 12 Apr 2016
avatar chrBrd chrBrd - close - 12 Apr 2016
avatar chrBrd chrBrd - change - 12 Apr 2016
Status Closed New
Closed_Date 2016-04-12 23:10:47
Closed_By chrBrd
avatar chrBrd chrBrd - change - 12 Apr 2016
Status New Pending
avatar chrBrd chrBrd - reopen - 12 Apr 2016
avatar chrBrd chrBrd - reopen - 12 Apr 2016
avatar chrBrd
chrBrd - comment - 12 Apr 2016

Added a potentially unnecessary check to make sure the 'option=' delimiter is in the menu link string, otherwise defaults to using component's <name>.

avatar brianteeman brianteeman - change - 13 Apr 2016
Category Installation Libraries
avatar chrBrd chrBrd - change - 13 Apr 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-04-13 06:40:33
Closed_By chrBrd
avatar chrBrd chrBrd - close - 13 Apr 2016
avatar chrBrd chrBrd - close - 13 Apr 2016
avatar chrBrd chrBrd - change - 13 Apr 2016
Status Closed New
Closed_Date 2016-04-13 06:40:33
Closed_By chrBrd
avatar chrBrd chrBrd - change - 13 Apr 2016
Status New Pending
avatar chrBrd chrBrd - reopen - 13 Apr 2016
avatar chrBrd chrBrd - reopen - 13 Apr 2016
avatar chrBrd chrBrd - change - 13 Apr 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-04-13 06:42:35
Closed_By chrBrd
avatar chrBrd chrBrd - close - 13 Apr 2016
avatar chrBrd chrBrd - change - 13 Apr 2016
Status Closed New
Closed_Date 2016-04-13 06:42:35
Closed_By chrBrd
avatar chrBrd chrBrd - change - 13 Apr 2016
Status New Pending
avatar chrBrd chrBrd - reopen - 13 Apr 2016
avatar chrBrd chrBrd - change - 13 Apr 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-04-13 07:38:23
Closed_By chrBrd
avatar chrBrd chrBrd - close - 13 Apr 2016
avatar chrBrd chrBrd - change - 13 Apr 2016
Status Closed New
Closed_Date 2016-04-13 07:38:23
Closed_By chrBrd
avatar chrBrd chrBrd - change - 13 Apr 2016
Status New Pending
avatar chrBrd chrBrd - reopen - 13 Apr 2016
avatar chrBrd chrBrd - change - 13 Apr 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-04-13 07:53:59
Closed_By chrBrd
avatar chrBrd chrBrd - close - 13 Apr 2016
avatar chrBrd chrBrd - change - 20 Nov 2016
Title
Fix for admin menu link attribute in component manifest doing nothing
// Invalid
avatar chrBrd chrBrd - edited - 20 Nov 2016
avatar joomla-cms-bot joomla-cms-bot - change - 20 Nov 2016
Category Installation Libraries Libraries

Add a Comment

Login with GitHub to post a comment