The core components com_content, com_menus and com_users feature special menuitems for a dashboard and a quicktask (eg create article)
I found no way of doing the same for my own component.
Since the core components com_banners, com_contact and com_newsfeed also don't have those features, I'm assuming it is missing for regular components that live in the "Components" menu.
This is a pity as those features look very promising.
I'd like to do the same for my component what core does.
In general, when adding a new feature to core components (especially com_content), we must always make sure the same feature can also be used by 3rd parties.
Labels |
Added:
?
|
Afaik, the installation routine doesn't allow for any such special attributes.
I had looked through the menu creation when I was looking how the "Fields" and "Fields Groups" menuitems can be made conditional like in core components (another such incosistency), but didn't see anything special.
But yes, it needs to be able to be specified in the component manifest XML where we define the <menu>
and <submenu>
entries.
Depends a bit how the solution will look. If it needs some change in the architecture to achieve it, then it should be at least a release blocker. Otherwise we're stuck with what we have.
Since I don't know yet the internal workings of this, I can't say much more.
Interesting enough, the definition for those special menuitem features are specified in "preset" XMLs in com_menu. This is a hardcoded list of presets:
joomla-cms/administrator/components/com_menus/Helper/MenusHelper.php
Lines 657 to 664 in 118d4c0
Basically what is defined in those preset XML, should be able to be defined also in component manifests.
Also, the already existing presets for specific component submenus (or dashboard menus?) (content, menus, users, ...) should live in the respective component folder. By moving those, we would actually get an architecture which 3rd party can use as well.
Pinging @Hackwar here since he seemed to be involved in this feature (according to GitHub). Maybe he has an idea how 3rd party can use it.
Status | New | ⇒ | Confirmed |
I think you got the icon covered.
But here it is about the special menuitems (dashboard/quicktask) which can't yet be added by 3rd parties. I'm quite sure that needs changes in the installer itself and maybe also in the CssMenu class.
iirc quicktask is the same as the add new function in joomla 3. Was that available to extensions?
Found the answer for the dashboard
iirc quicktask is the same as the add new function in joomla 3. Was that available to extensions?
Yes, it looks the same (not sure if technically, it's done the same). No it wasn't available to 3rd party. That's why haven't filed this as bug but as feature request.
I'll have to find sometime to dig into this a bit more. I think I got the clues together to find a solution, just no time yet
You can add your own dashboard by simply using a URL like the dashboards for a menu entry in your component. For the icon next to the menu item, you can add the parameter to the XML of the view. That way you can have this in your custom backend menu. For such an icon upon installation, I would (for now) advise to set these parameters in the menu item in an install script, since there you should also create the module instances which should populate the dashboard. Otherwise you would have a dashboard upon installation, but it would be empty... Yes, that isn't ideal, but so far the best solution that I an offer.
You can add your own dashboard by simply using a URL like the dashboards for a menu entry in your component.
I "think" the question was how to add to the existing dashboards. For example how to add a "backup" component to the system dashboard and not the component dashboard
For the icon next to the menu item, you can add the parameter to the XML of the view
You can now my PR was merged :)
I would (for now) advise to set these parameters in the menu item in an install script, since there you should also create the module instances which should populate the dashboard. Otherwise you would have a dashboard upon installation, but it would be empty... Yes, that isn't ideal, but so far the best solution that I an offer.
That's exactly what I want to prevent. It basically shows that the dashboard functionality wasn't built exactly with 3rd parties in mind. To much special handling for core.
I "think" the question was how to add to the existing dashboards. For example how to add a "backup" component to the system dashboard and not the component dashboard
That is not what I meant in this issue here, but is an important request as well. It's bad UX if the user has to manually add such modules to the system view.
I found a solution to add those dashboard/quicktask icons to the menu.
However I'm not closing this issue yet, since there are other aspects (like having presets for the dashboard and "hooks" for the system dashboard) which I believe are not solved.
One step closer. I can add presets from my own component now.
Now to find a way to automatically add modules (most importantly the mod_submenu) to my dashboard without using a complex script. Already looked at SQL but since modules have an asset, that's not a simple insert into the #__modules table.
Grab the com_modules backend model and use that. shouldn't be too hard. that will ensure the asset gets created
Yep, but that means every component needs to do that in their custom install script. Imho that's the worst case scenario (not bad, but still worst case
I'd prefer that the installation routine can handle that itself. But I don't have yet the elegant idea that I want :)
So write a method in the InstallerScript https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Installer/InstallerScript.php that will insert a module using the backend model. Give people the minimal parameters required and people who need more complicated dashboards can just do use that method as a starting point and copy/paste
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-02-23 13:10:42 |
Closed_By | ⇒ | Bakual |
I think thats everything
I believe it there
joomla-cms/administrator/modules/mod_menu/tmpl/default_submenu.php
Lines 150 to 169 in 7c931f5
The component menu should have
menu-quicktask
param, with some extra param.In theory it can be enabled by user when he/she create a menu item.
Not sure how it can be done while component installation. Extra xml attributes for
<menu />
?