Skip to content

[4.0] Load presets from component directory#27869

Merged
rdeutz merged 5 commits intojoomla:4.0-devfrom
Bakual:40LoadPresetsFromComponentDirectory
Feb 11, 2020
Merged

[4.0] Load presets from component directory#27869
rdeutz merged 5 commits intojoomla:4.0-devfrom
Bakual:40LoadPresetsFromComponentDirectory

Conversation

@Bakual
Copy link
Copy Markdown
Contributor

@Bakual Bakual commented Feb 9, 2020

Pull Request for Issue #27765.

This tackles the issue that 3rd party components couldn't easily have presets menus (eg for the dashboard) like core components have.

Summary of Changes

Currently, the list of presets is hardcoded in the menuhelper. This PR changes this to a dynamically loaded list. It looks in each enabled component if there is a presets folder and loads all XML presets found there.
This also moves the existing component specific presets for com_content and com_users to their respective component folder, instead of having them in com_menus.
The language strings are taken out from mod_menu.ini and lib_joomla.ini and moved to the place where the corresponding presets lives, so either com_content, com_users or com_menu (for the "system" ones).

Testing Instructions

After applying the PR, check that the menu (main and alternative) and the various dashboards still work as expected.
To test 3rd party, you can copy an existing preset file to a 3rd party component and renamed it. Then see if it shows up in the presets list in the "Administrator Menu" and "Administrator Dashboard Menu" modules.
Or you can use my component and see if the "SermonSpeaker Dashboard" Preset comes up there.
com_sermonspeaker.zip

Expected result

Presets are loaded from component folders as well and all component specific assets (preset, language strings) are contained in the component folder.

Actual result

Presets are hardcoded in com_menus. Language strings reside in lib_joomla and mod_menu.

Documentation Changes Required

Probably in the 4.0 Component development guide.

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.0-dev labels Feb 9, 2020
@Bakual Bakual changed the title 40 load presets from component directory [4.0] Load presets from component directory Feb 9, 2020
@Bakual
Copy link
Copy Markdown
Contributor Author

Bakual commented Feb 9, 2020

One thing to think about is that all presets are currently using the same "namespace" (for lack of a better word). Which means if another component uses the same preset name as another (eg "default"), the first one gets overwritten.
However that is already the case today as you can register own presets programmatically using eg a plugin.
Thus I thought it's out of scope for this PR.

@chmst
Copy link
Copy Markdown
Contributor

chmst commented Feb 10, 2020

I have tested this item ✅ successfully on f81879a

Tested with an own component.

After test, the Warning for missing parts of the menu of my own componente is incomplete: "The administrator menu jottovoter does not have - Menu Manager. Select to turn on the menu recovery mode." - Does not have what?
EDIT: Message is not incomplete but confusing.

But this is out of scope of this PR.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27869.

@jwaisner
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on f81879a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27869.

@jwaisner
Copy link
Copy Markdown
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27869.

@joomla-cms-bot joomla-cms-bot added RTC This Pull Request is Ready To Commit and removed Language Change This is for Translators PR-4.0-dev labels Feb 10, 2020
@Quy Quy added the PR-4.0-dev label Feb 10, 2020
@rdeutz rdeutz merged commit 763bdb3 into joomla:4.0-dev Feb 11, 2020
@joomla-cms-bot joomla-cms-bot added the Language Change This is for Translators label Feb 11, 2020
@rdeutz rdeutz added this to the Joomla 4.0 milestone Feb 11, 2020
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Feb 11, 2020
@Bakual Bakual deleted the 40LoadPresetsFromComponentDirectory branch February 11, 2020 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants