Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

// Invalid #9882

Closed
wants to merge 13 commits into from
Closed

// Invalid #9882

wants to merge 13 commits into from

Conversation

chrBrd
Copy link
Contributor

@chrBrd chrBrd commented Apr 12, 2016

Issue

The link attribute in the parent administrator

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, attribute. As there is usually not a value set for this it defaults to using the component's , 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

tag.

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

Testing Instructions

  • Download the MVC Component tutorial archive.
  • In the component's XML manifest file change the 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 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 tags in a manifest. It will also function as normal and default to the 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 attribute.

@chrBrd chrBrd reopened this Apr 12, 2016
@chrBrd
Copy link
Contributor Author

chrBrd commented Apr 12, 2016

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

@chrBrd chrBrd closed this Apr 13, 2016
@chrBrd chrBrd reopened this Apr 13, 2016
@chrBrd chrBrd closed this Apr 13, 2016
@chrBrd chrBrd reopened this Apr 13, 2016
@chrBrd chrBrd closed this Apr 13, 2016
@chrBrd chrBrd reopened this Apr 13, 2016
@chrBrd chrBrd closed this Apr 13, 2016
@chrBrd chrBrd changed the title Fix for admin menu link attribute in component manifest doing nothing // Invalid Nov 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants