-
-
Couldn't load subscription status.
- Fork 3.7k
Admin Menu custom presets, import/export a preset into/from database driven menu #16451
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
Conversation
… rendering to layout files to facilitate template overrides.
a309e80 to
c787b79
Compare
| { | ||
| $menuItems = array(); | ||
|
|
||
| JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i didn't review the rest of the PR, but just one comment to this line
Why catch the default JDatabase (or Registry) exception and replace it with something called JERROR_AN_ERROR_HAS_OCCURRED?
This is more or less the same as saying: "Joomla knows the system is not working properly but doesn't have idea what happened! All it can say is .. an error has occurred ..." 😄
Maybe use $e->getMessage() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I actually reused the old code as is. I'll fix when I get to steal few minutes. Please review further so I can fix them all at once. Thanks.
|
@sanderpotjer It would be really great if you could look at this in the light of our disscussion at #13036 (comment). Thanks. |
|
Hello Izhar, To avoid this error there might be options like:
I got two other error messages after creating a new menu: |
|
Method of import Iit would be helpful to have an option to either add the new preset to the existing items or replace all existing items. So there is the possibility to add either a preset for only a component or a full menu. New presets not showing File structure xml vs. php Suggestion for mobile view This would be a good feature for people who do a lot of their work with mobile devices. And it would kind of restore a possibility you had with php files before. |
|
@StefanSTS Below are my responses as per my understanding to your inputs:
If we replace all the existing menu items during a single click import process it would be an easy destructive action. Therefore, I omitted that feature on purpose. The user must "select all" and "delete" all existing menu items if so intended.
I tested this and it is working here as expected. I may be missing something, please let me know if you still get this issue.
The preset XML files are to represent the menu item definition and hierarchy. Their rendering is still controlled via the layout files in the Therefore, you still have all the controls over the rendering while keeping the preset definition as simple and general. Additionally, I'd like to mention that those |
|
Thanks for your reply, Izhar. I will be testing again when time permits on a fresh installation. This week is a little tight though, not sure if it will fit in. |
|
@izharaazmi can you look at the merge conflicts please - then i can test it :) |
|
Sure |
|
@brianteeman I have resolved the conflicts. Travis failure is due to some internal error and not on code. |
|
@brianteeman @andrepereiradasilva It'd be great if we could get this before the 3.8 feature freeze. |
|
|
|
@brianteeman Could not reproduce this anywhere. May be I'm missing somewhere. Can you please guide me the steps through it? |
|
I got it immediately after applying the patch will try again later |
|
Got same Error as @brianteeman wrote. |
|
@brianteeman @franz-wohlkoenig There seems to be some issue with the patch tester applying this patch. Please use the source branch izharaazmi/joomla-cms/menu-preset-features.zip for testing. I have updated the branch with the latest staging so there should be no conflicts. |
|
I have tested this item ✅ successfully on 39b96e1 Works fine here. 😃 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16451. |
|
@brianteeman @franz-wohlkoenig Can you try again please! Running out of time for feature freeze. |
|
I have tested this item ✅ successfully on 39b96e1 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16451. |
|
RTC after two successful tests. |
|
Is this too late for 3.8 feature freeze?
|
|
@mbabker |
| '/libraries/legacy/web/client.php', | ||
| '/libraries/legacy/web/web.php', | ||
| // Joomla! __DEPLOY_VERSION__ | ||
| '/administrator/modules/mod_menu/preset/enabled.php', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be moved up the list. There's already a 3.8 section started.
| '/libraries/legacy/view', | ||
| '/libraries/legacy/web', | ||
| // Joomla! __DEPLOY_VERSION__ | ||
| '/administrator/modules/mod_menu/preset', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several file permissions are changed from 0644 to 0755. Those need to be fixed.
|
Fixing both
|
* add filteroption to select tag to filter * all php logic to get selected filter option * add nice lines to separate fitler by tag from the rest. * fix code style * conditional load tags. Only load when filter is used
* staging: (35 commits) Add filter by Tag to mod_article_category (joomla#16945) Change links Implement component params for fieldgroups (joomla#17317) Moved JLanguageMultilang::isAdminEnabled() to JModuleHelper::isAdminMultilang() (joomla#17314) Fix tests Namespace sodium cipher, use compat API Fix namespace use and class casing Various doc block fixes and removing unneeded imports Class mappings for internal classes that apparently aren't internal Don't load unexisting paths Cleanup and optimization in FinderIndexerDrivers (joomla#13511) Fix deleted files listing Deleted files updated Rename the document renderer base class Split feed data object classes to separate files Correct class name logic Deleted files for joomla#17278 Namespace feed (joomla#17278) [CS] Required=true (joomla#17313) required = false is nnot required (joomla#17309) ...
Summary of Changes
As we know that with the release of Joomla 3.7 we have the Admin Menu Manager that lets you customise the administrator menu according to your needs. The backend menu comes in two flavours: Custom Menu and Preset Menu. You can have as many custom menu each configured in different way as suitable. Or if you do not want to customise then you use the Preset menu.
This PR is indented to extend the features for this Admin Menu Manager as promised in the initial strategy.
Changes
Custom Presets:
If you copy (and modify) one of the existing preset files from
/administrator/com_menus/presetsto/administrator/templates/{your_template}/html/com_menus/presetsthen you can use it as your own custom preset.Import Preset Menu:
If you would like to modify merely one or two things and keep rest of the menu structure the same way as in a preset menu you still need to create all of those links one by one yourself manually. After this PR Joomla will allow you to directly import an existing preset (core or custom) into your custom admin menu directly and then you can customise it very quickly. When creating/editing a
Menu(menutype) you can optionally select a preset that you would like to import.Export Menu as Preset:
You can also export your database driven
custom admin menuas an a Preset. Just select a Menu in the list and clickDownload As Presetbutton in the toolbar.Menu Module Layout Override:
The current implementation of the Admin Menu Module has the HTML rendering from within the PHP class
JAdminCssMenuwhich does not let you customise the HTML in any way. This PR puts all the HTML output logic into the layout files undertmpl/folder as commonly expected. This way you can easily override the layout in your template.Menu Structure Override:
Prior to Joomla 3.7 we could override the menu links using
default_enabled.phpanddefault_disabled.php. After the Menu Manager was introduced this ability was removed. Most likely you would really never need this anymore. It is always better to import a preset in a custom menu and customise it in the Menu Manager instead of messing with any PHP code. However, if you still insist, you can use the Custom Preset as discussed above. The naming convention is likemy-custom-menu.xmlbecomesMy Custom Menu(we can improve this later if needed). It is really easy to understand and work with. Give it a try.Testing Instructions
Create a custom admin menu and set it as your active admin menu in the module settings.
Try to choose another preset in the module settings. The displayed menu should be updated according the selected preset.
Create a custom preset by copying (as discussed above) and make some changes. Set this custom preset as your active menu. The menu should now load you custom preset.
Create new custom admin menu and choose a preset to import. This should load the menu links and hierarchy from the preset.
From the list view of Menu, select one of your Admin Menus and click on "Download as Preset" button. The XML file should be downloaded correctly and should contain the selected menu links with correct settings.
Documentation Changes Required
I'd like to write the detailed documentation of the entire Admin Menu Manager. Please advise where should I head towards.
PS: As I am on a vacation this PR was created in hurry. Pardon me for any mistakes and please ask for any kind of clarifications or suggestions. I'll try to respond as quickly as possible.