User tests: Successful: Unsuccessful:
Pull Request for issue joomla/joomla-cms#5492
Currently we have menu and menu items for front-end that we manage via Menu Manager. However, for the Backend Menu we do not have any choice. We are bound to use that statically hardcoded menu since long time now.
With this PR I am proposing the flexibility and control over the menu and menu items for Joomla Backend like we have for the Front-end. You can now create, edit, move and organise the menu links the way you like. And if like you can still use the "preset menu" shipped by default with Joomla without any customisation at all.
After this patch you'll have one extra dropdown in Menu manager lists viz. "Client" that can be used to switch between whether you are managing menu and menu items for Front-end or Backend.
When you have client filter "Administrator" selected in the list, clicking on "New" will take you to the Backend Menu Item creation page only. Having "Site" selected will get you a form to create Front-end menu/menu item likewise. This behavior is certainly not new for us, this can be seen in the existing Module Manager already.
The list of available menu type options are taken the same way that it did for front-end menu type options earlier. All the menu items that exists currently can be created using the Menu Manager in a custom Menu. Then it can be published in the mod_menu for backend, which currently is using a hardcoded menu.
How will my administrator interface looks change after this?
It will look exactly the same as before. The appearance is only affected if you choose to customise your backend menu via Menu Manager.
What do I need to learn to use this new Menu Manager?
Almost Nothing! If you are familiar with the existing Menu Manager and have used it to create menu and menu items for front-end, then you will feel at home. Everything remains the same. When creating a menu item for backend you will see the options related to backend only. Similarly, you will see only front-end options when you create a menu item for front-end.
Where do the menu links gets created for NEW components that I install?
The menu links are created in the same way as before for every new component installation. You can create a "Heading" type menu item (say, "New Components") and set the flag "Components Root" to "Yes". This will pull all those menu items under "New Components".
Please note, that this component root is NOT required to be a Top level menu item, it can be any level down.
How can I remove an auto created component menu item from the Component Root parent after I have created my own menu item for it at desired location?
In the menu items list view, set the menu type filter to "Main (Protected)". You will see all those automatically generated menu items there. Just unpublish the desired items. If the component root has not children to show, the component root will also be hidden automatically.
Deleting them should not cause any side effect, however its not recommended to do so. Editing these items is disabled to avoid undesirable consequences.
Please note that if you decide to switch back to the "preset" menu anytime, these auto-generated Menu items will show up under "components" again. Due to B/C reasons preset menu does not obey published/unpublished state.
How can I create Multilingual versions of those backend menu items?
Language based associations are disabled for backend menu items for consistency and simplicity. The menu title is translated during their rendering, therefore you can use LANGUAGE_KEYS and their translations to use it on multilingual websites. 1
Will Joomla! be shipped with a default menu created?
Joomla! will come with built-in preset(s) which will not show up in menu manager. That would be the set as the default menu. You can use it by selecting in the Module manager mod_menu settings. If you want to create and use your own custom menu you can create an new Menu at "Menus > Add New Menu" and build your desired links under it. Next you will choose your own Menu in the Menu module settings via Module Manager.
What if I do not have a component root defined in my custom menu when I install new components?
The "component root" does NOT tell Joomla where to create those menu items. It just says, where to show them. So relax, the automatic menu items will still be created in the same way as now (even without this PR) irrespective of your component root selection. If you have one it will pull them in, and if not they won't show up.
This way we can always ensure that they will be shown exactly the same when you switch back to the preset menu for any reason.
I messed up my menu structure and it will take time to build it over. Can I get the default Joomla menu back?
Absolutely! Its in there already. Just go to module manager and edit mod_menu for administrator. Choose the System Preset as your active menu. Keep it forever, or as long as you need.
I am an extension developer. What do I need to change in my components to make use of this new feature?
This update will NOT cause your components to lose any links in the backend menu. If you have any Menu/Submenu under "Components" then your user will still be able to create those links in their custom menu.
Well, Ideally you should create layout manifests for all your view/layouts that can be linked to a menu item so as to offer your users better control and flexibility over customisation.
client_id
column to your #__menu_types
table.Add information about this feature in the documentation.
Thanks @brianteeman for his support and valuable inputs.
1 In the edit form we can have a set of text inputs for alternative texts per installed language.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_admin SQL Postgresql MS SQL com_cache com_categories com_checkin com_config com_content com_cpanel com_installer com_joomlaupdate com_languages com_media |
Closing as I have not tested it myself against staging branch. Will reopen after tests and changes if any.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-11-27 08:42:44 |
Closed_By | ⇒ | izharaazmi | |
Labels |
Removed:
?
|
@izharaazmi if you press the edit button next to the title, you are able to rebase from 3.7
to staging
Thanks. I did that but reverted back as I am not aware of the codebase
changes in that branch. Not sure what would break.
if no conflicts come up, I guess the code will be ok
There were 5 conflicts.
Reopening after conflicts merge and a basic testing.
Status | Closed | ⇒ | New |
Closed_Date | 2016-11-27 08:42:38 | ⇒ | |
Closed_By | izharaazmi | ⇒ |
Status | Closed | ⇒ | Pending |
Category | Administration com_admin SQL Postgresql MS SQL com_cache com_categories com_checkin com_config com_content com_cpanel com_installer com_joomlaupdate com_languages com_media | ⇒ | Administration com_admin SQL Postgresql MS SQL com_banners com_cache com_categories com_checkin com_config com_contact |
Something isnt correct as you have 357 changed files
yes, fixing it. Sorry for the mishap.
Category | Administration com_admin SQL Postgresql MS SQL com_cache com_categories com_checkin com_config com_banners com_contact | ⇒ | Administration com_admin SQL Postgresql MS SQL com_cache com_categories com_checkin com_config com_content com_cpanel com_installer com_joomlaupdate com_languages com_media |
@brianteeman Can you please check if everything is alright now?
Not for the fainted at heart but looks like working. ;)
Tip: when creating the new menu items for the new admin menu, always create at least 2 of them first: Menu Items and Modules
First set of remarks, in no special order:
NOTE 1: Creating modules menu gets:
Strings are wrong in modules default.xml. Missing a S
Should be
+COM_MODULES_MODULES_VIEW_DEFAULT_DESC="Shows a list of modules to manage"
+COM_MODULES_MODULES_VIEW_DEFAULT_TITLE="Module Manager"
NOTE 2: Default Page
should not be present when creating an admin menu item
NOTE 3: All new lang strings should be alpha ordered
NOTE 4: Link Image
will not work in Isis or Hathor
NOTE 5: Is it on purpose that one can use multiple admin menus at the same time by just publishing their respective modules?
NOTE 6: The alias limitation to not use a root folder name or component
should NOT apply to admin menu items as aliases are not used here.
Concerning lang keys, not sure you got it.
They should be alpha ordered with the existing ones.
Example, you do
COM_CONFIG="Configuration Manager"
COM_CONFIG_XML_DESCRIPTION="Configuration Manager"
COM_CONFIG_COMPONENT_VIEW_DEFAULT_DESC="Dislay the configuration options for the selected component."
COM_CONFIG_COMPONENT_VIEW_DEFAULT_TITLE="Component Configuration Options"
COM_CONFIG_CONFIG_VIEW_DEFAULT_DESC="Displays basic site configuration options."
COM_CONFIG_CONFIG_VIEW_DEFAULT_TITLE="Site Configuration Options"
COM_CONFIG_TEMPLATES_VIEW_DEFAULT_DESC="Displays template parameter options if the template allows this."
COM_CONFIG_TEMPLATES_VIEW_DEFAULT_TITLE="Display Template Options"
it should be
COM_CONFIG="Configuration Manager"
COM_CONFIG_COMPONENT_VIEW_DEFAULT_DESC="Dislay the configuration options for the selected component."
COM_CONFIG_COMPONENT_VIEW_DEFAULT_TITLE="Component Configuration Options"
COM_CONFIG_CONFIG_VIEW_DEFAULT_DESC="Displays basic site configuration options."
COM_CONFIG_CONFIG_VIEW_DEFAULT_TITLE="Site Configuration Options"
COM_CONFIG_TEMPLATES_VIEW_DEFAULT_DESC="Displays template parameter options if the template allows this."
COM_CONFIG_TEMPLATES_VIEW_DEFAULT_TITLE="Display Template Options"
COM_CONFIG_XML_DESCRIPTION="Configuration Manager"
Thanks
I only moved my new keys to appropriate place alpha-orderd. Others were already there. Let us fix all those in a separate PR.
I have fixed other issues.
Labels |
Added:
?
|
Tip: when creating the new menu items for the new admin menu, always create at least 2 of them first: Menu Items and Modules
Was that for me? If so, sorry I didn't get it.
Default Page should not be present when creating an admin menu item
Removed for now. However I intend to make it do what it says if possible, but some other day.
Is it on purpose that one can use multiple admin menus at the same time by just publishing their respective modules?
Yes, I don't see a reason not to let the users do that if they really want to.
Fixed other mentioned issues. Thanks @infograf768
PS: Not sure how this reply did not get posted. Ref to e8de57a
Tip: when creating the new menu items for the new admin menu, always create at least 2 of them first: Menu Items and Modules
Was that for me? If so, sorry I didn't get it.
That was for testers and future users. It is easy to lose all admin menus and be forced to modify db to recover access.
@infograf768 Thanks for your reviews and feedbacks. If you have tested this can you please mark your test status here!
Although this apparently works, I have not yet reviewed all code and eventual consequences of the changes on other aspects of the CMS.
@izharaazmi
I have asked to release responsible to decide if this could go into 3.7.0
If yes, then I will test more as there are some aspects that still need some care.
Thanks @infograf768. Looking forward. Excited to see it soon!
Very tempted to include it in 3.7, we need a bit more testing
@izharaazmi
Can you think of a way to prevent such situation:
Tip: when creating the new menu items for the new admin menu, always create at least 2 of them first: Menu Items and Modules
That was for testers and future users. It is easy to lose all admin menus and be forced to modify db to recover access.
This link administrator/index.php?option=com_menus&view=menu&layout=edit
does not work on mssql.
[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]No column name was specified for column 1 of 'A'. SQL=SELECT * FROM ( SELECT count(id), ROW_NUMBER() OVER (ORDER BY (select 0)) AS RowNumber FROM j37_usergroups) A WHERE A.RowNumber BETWEEN 1 AND 1
After added patch from #13262 start working:)
Well, I initially did that by creating an entirely new menu module mod_adminmenu
so that the user can unpublish the mod_menu
only after ensuring their new setup works fine.
But I quickly dropped that idea it was essentially code duplicate of mod_menu
and user may still unpublish the old one earlier, nothing would stop them.
Another approach that comes to my mind is we fallback to preset when their is no menu items in the selected menutype
. This behavior too can then be turned off by a setting in mod_menu
.
Another approach that comes to my mind is we fallback to preset when their is no menu items in the selected menutype. This behavior too can then be turned off by a setting in mod_menu.
Alas, one could create another type of menu item than Menu Items menu and Modules manager. Including only the Article menu would not help.
We also have to deal with access and permissions here.
A default installation gives permissions to Managers and up full access to Menu Manager and Modules Manager. These users are set to the Special Access group, which is also the case for the existing Admin Menu module.
Hmm... I was thinking of a specific button always present in the menu bar that would force display an admin menu with all existing menus, but just discovered that one can unpublish the existing admin menu and even delete it... which is rather weird.
Even worse than that, the Administrator Menu can be uninstalled. It is not even protected...
@infograf768 We can show a warning to the "Special" users if the current
admin menu does not have links to "Module Manager" or "Menu Manager"
defined at all. From there we allow something in line with your idea, like
"index.php?recover_menu=1" that would set "preset menu" to be shown under a
special "Menu Item Root"
This option can persist for the entire session or until user goes to
"index.php?recover_menu=0"
How does this work for third party components? Does this work for them without any changes for the moment? Otherwise we can only include this in 4.0, not in the 3.x versions.
Looking at the component installer, I have the feeling that there are more issues here, too. How is decided where the components menu items are injected upon installation? This has still be done automatically and I don't see how this is set up when the menu has already been customised.
@Hackwar
Although it is a bit complex, reading the test instructions should help you...
Where do the menu links gets created for NEW components that I install?
The menu links are created in the same way as before for every new component installation. You can create a "Heading" type menu item (say, "New Components") and set the flag "Components Root" to "Yes". This will pull all those menu items under "New Components".
Please note, that this component root is NOT required to be a Top level menu item, it can be any level down.
All this can be customised, for core as well as 3rd party components by choosing filtering by Main (protected) and Menu (Protected) and unpublishing the ones you don't want there.
Basically, even if you have unpublished some items, new components will display fine in such a menu.
Going on testing now.
@infograf768 We can show a warning to the "Special" users if the current admin menu does not have links to "Module Manager" or "Menu Manager" defined at all. From there we allow something in line with your idea, like "index.php?recover_menu=1" that would set "preset menu" to be shown under a special "Menu Item Root" This option can persist for the entire session or until user goes to "index.php?recover_menu=0"
This looks like a good idea.
@infograf768 I thought to put this check in mod_menu
itself. However, in case the mod_menu
is unpublished or deleted we won't be able to show that message.
Should we consider such cases? If yes, can you suggest some other suitable place to put this code?
A few issues:
A. The dropdown for menus should differentiate between site and admin menus.
Maybe with a separator.
B. When multilingual is on, the Associations Tab should not display for admin menu items.
In the manager as well as when creating/editing such menu items
In the manager, one would use:
<?php if ($assoc && $this->state->get('filter.client_id') == 0) : ?>
For individual menu items, add clientId to conditional line 161
<?php if ($this->item->type !== 'alias' && $this->item->type !== 'url' && $this->item->type !== 'separator' && $this->item->type !== 'heading' && $clientId !== 1) : ?>
C. When in multilanguage and using associations, filtering by site or admin should not be accepted in the popup. It should always be site only,
Will go on testing later.
@izharaazmi
Concerning C. above, we can patch this way in /administrator/components/com_menus/views/items/view.html.php
Change from line 232 to
else
{
// In menu items associations modal we need to remove language filter if forcing a language.
if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'CMD'))
{
// If the language is forced we can't allow to select the language, so transform the language selector filter into an hidden field.
$languageXml = new SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />');
$this->filterForm->setField($languageXml, 'filter', true);
// Admin menus should not be proposed
$this->filterForm->setFieldAttribute('menutype', 'clientid', '0');
// Client should always be site
$this->filterForm->removeField('client_id');
// Also, unset the active language filter so the search tools is not open by default with this filter.
unset($this->activeFilters['language']);
}
}
please correct the PR with my proposals above.
Then we will ask some other people advice concerning the alert.
Accept my apologies for not being able to attend this for so long. This year transition was too busy.
Conflicts are resolved and suggested fixes applied.
Also added recovery mode for menu where the selected admin menu does not contain link to module manager and/or menu manager. This check can be disabled from menu module configuration.
PS: Happy New Year to all fellow Joomlers, though I'm too late...
Will test later.
Gave it a test on latest staging and had some issues in the module edit view not having menus or expected settings. Could possible be because of the missing field_id in menu_type that I added manually a step later than good was.
So will retest a little later.
The visual styling of the menus did seem to have gotten an extra navigation layer that was hard to navigate through. Is that intended or a mistake in applying this larger patch? See screenshot
Sorry My bad. Fixed the "extra navigation layer" issue.
@izharaazmi
There are conflicts
@infograf768 Conflicts resolved. Thanks.
<field
name="check"
type="radio"
label="MOD_MENU_FIELD_CHECK_LABEL"
description="MOD_MENU_FIELD_CHECK_DESC"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
To
name="check"
type="radio"
label="MOD_MENU_FIELD_CHECK_LABEL"
description="MOD_MENU_FIELD_CHECK_DESC"
class="btn-group btn-group-yesno"
default="1"
>
The warning displays even when there are menu items to Menu Manager. It disapears when there is also a link to the Modules Manager.
It looks like we do need both
therefore the string is wrong:
MOD_MENU_WARNING_IMPORTANT_ITEMS_INACCESSIBLE="The active administrator menu does not contain links to atleast one of <strong>Module Manager</strong> and <strong>Menu Manager</strong>. Click to <strong><a href='index.php?recover_menu=1'>turn on the menu recovery mode</a></strong>."
if you correct the code, also please correct typo: at least
and not atleast
Or change the string to
does not contain links both <strong>Module Manager</strong> and <strong>Menu Manager</strong>.
The association column should not be present in the Administrator Menu items Manager.
I posted the code above
Use <?php if ($assoc && $this->state->get('filter.client_id') == 0) : ?>
instead of
<?php if ($assoc) : ?>
in both places in /administrator/components/com_menus/views/items/tmpl/default.php
To testers: not forget to make the query change.
ALTER TABLE
#__menu_typesADD
client_id` int(11) NOT NULL DEFAULT 0;
UPDATE #__menu
SET published
= 1 WHERE menutype
= 'main' OR menutype
= 'menu';`
as otherwise one can't get to the admin interface.
@infograf768 Done!
@izharaazmi Double navigation fixed on last check thanks. Had some other issues with this heavy patch, but will try again with the extra info about UPDATE _menu from @infograf768 mentioned above. Only did manually add the field_id and ran a db fix. Will check this important new feature again during the weekend.
After installing PR got
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) in __/Joomla/administrator/modules/mod_menu/tmpl/default.php on line 16
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) in __/Joomla/libraries/vendor/joomla/registry/src/Registry.php on line 85
Having the same issues as mentioned by @franz-wohlkoenig on a clean staging setup with this PR applied.
I have resolved the conflicts shown up today. I also notice that the patchtester does not apply the patch correctly and still shows the success message. This could be the possible reason for the above errors.
Is it possible (and correct?) to test the branch https://github.com/izharaazmi/joomla-cms/tree/admin-menu-manager? Its upto date with staging as of now.
Patch tester is only an aide. It's not the de facto testing tool and will never work as accurately as either applying the patch with a proper patching tool or downloading the remote branch (at least for the filesystem part of things).
@izharaazmi first of all: thanks for your PR! I do think there are quite some people that would welcome this feature in Joomla.
I have had my first testing, and here is some initial feedback:
Possibly for the future
I have not seen any real errors yet, but as this is a major new feature I will continue testing over the next days and will possibly get back with some more feedback.
(This message was sent garbled due to markdown no supported. See the original message below)
@sanderpotjer Thanks for your valuable feedback.
- Move "Menu to Show" & "Check Menu" params in mod_menu to "Module" tab instead of "Advanced", or is there a specific reason to put it under advanced.
Advice noted, I'll look into that. Thanks.
- Is there a specific reason to move the "preset" menu layouts to the "preset" folder of mod_menu? I would recommend leaving it in the tmpl folder, this will allow people to still user template overrides for the mod_menu.
Sounds good. Though my plan is to offer multiple presets including custom
ones. We can discuss on this.
"Check Menu", I wonder if this even should be an option or not. Might be better to have this feature enabled by default.
In case user is ok with the said links in the admin homepage and does not
care about it in the menu, then that would be a pain.
- I personally think it would be great if there would be an option to convert the default Joomla menu into the "custom admin menu", in that way you don't have to rebuild the entire menu if you just want a couple small changes.
In my to-do list:
- 3rd party components: I do think it would be great for the flexibility if you can at least create a menu item for each installed component, also the 3rd party ones. So maybe a new admin menu type "components" in which you can select the component, like "com_jce", this would create a admin menu item to index.php?option=com_jce
It's already possible to create menu items for all installed 3PD components. Not just root level rather sub menu too if defined so in their install manifest. B/C ok.
If you meant something else, please elaborate.
Possibly for the future
- A powerful option would be to add some filter presets, so for example for the com_content articles view. If you could set the default category, state etc.. people can create backend menu items to specific filtered views.
Honestly, I didn't understand this right. Please explain.
I have tested this item
Tested according to the very nice testing instructions and could go through all the steps for this great new feature. Good stuff!
Good job done, thanks! :)
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 2016-11-27 08:42:38 | ⇒ | 2017-01-17 10:42:03 |
Closed_By | izharaazmi | ⇒ | rdeutz |
I have merged this because it seems to be in a good enough state to go into the alpha2 of 3.7. Smaller problems and issues can be figured out on the way to 3.7 Stable
Thanks @brianteeman, @infograf768, @sanderpotjer, @ot2sen, @rdeutz and everyone else for make this through into J3.7.
Excited!
I am not sure who to ask for... In the alpha2 release note my name has a missing "i".
Izhar Aazm_ should be Izhar Aazmi
@izharaazmi sorry, fixed
Ah that happens.
this brings up an interesting thought. If you can make more than one admin menu, you COULD make different views for different types of admins, except as a default, all we have for the access drop down is Special and Super Users. I'm going to mess around with adding more access levels based on say, Administrator and see if it reacts well assigned to just that.
Ha! quick way to break your admin? Accidently change the settings in Special instead of copying it.
@brianpeat thanks for the comment, good to see that merging it was a good idea
This PR should be targetted at staging, not 3.7.x