?
avatar Bakual
Bakual
1 Feb 2020

Is your feature request related to a problem? Please describe.

The core components com_content, com_menus and com_users feature special menuitems for a dashboard and a quicktask (eg create article)
image

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.

Describe the solution you'd like

I'd like to do the same for my component what core does.

Additional context

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.

avatar Bakual Bakual - open - 1 Feb 2020
avatar joomla-cms-bot joomla-cms-bot - change - 1 Feb 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 Feb 2020
avatar Fedik
Fedik - comment - 1 Feb 2020

I believe it there

if ($currentParams->get('menu-quicktask', false))
{
$params = $current->getParams();
$user = $this->application->getIdentity();
$link = $params->get('menu-quicktask-link');
$icon = $params->get('menu-quicktask-icon', 'plus');
$title = $params->get('menu-quicktask-title', 'MOD_MENU_QUICKTASK_NEW');
$permission = $params->get('menu-quicktask-permission');
$scope = $current->scope !== 'default' ? $current->scope : null;
if (!$permission || $user->authorise($permission, $scope))
{
echo '<span class="menu-quicktask"><a href="' . $link . '">';
echo '<span class="fa fa-' . $icon . '" title="' . htmlentities(Text::_($title)) . '" aria-hidden="true"></span>';
echo '<span class="sr-only">' . Text::_($title) . '</span>';
echo '</a></span>';
}
}

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 />?

avatar Bakual
Bakual - comment - 1 Feb 2020

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.

avatar richard67
richard67 - comment - 1 Feb 2020

@wilsonge Do you think this is a release blocker? Or even a beta blocker?

avatar Bakual
Bakual - comment - 2 Feb 2020

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.

avatar richard67
richard67 - comment - 2 Feb 2020

Since I don't know yet the internal workings of this, I can't say much more.

@Bakual Same for me, that's why I've pinged George.

avatar Bakual
Bakual - comment - 2 Feb 2020

Interesting enough, the definition for those special menuitem features are specified in "preset" XMLs in com_menu. This is a hardcoded list of presets:

static::addPreset('default', 'JLIB_MENUS_PRESET_DEFAULT', JPATH_ADMINISTRATOR . '/components/com_menus/presets/default.xml');
static::addPreset('alternate', 'JLIB_MENUS_PRESET_ALTERNATE', JPATH_ADMINISTRATOR . '/components/com_menus/presets/alternate.xml');
static::addPreset('system', 'JLIB_MENUS_PRESET_SYSTEM', JPATH_ADMINISTRATOR . '/components/com_menus/presets/system.xml');
static::addPreset('content', 'JLIB_MENUS_PRESET_CONTENT', JPATH_ADMINISTRATOR . '/components/com_menus/presets/content.xml');
static::addPreset('help', 'JLIB_MENUS_PRESET_HELP', JPATH_ADMINISTRATOR . '/components/com_menus/presets/help.xml');
static::addPreset('menus', 'JLIB_MENUS_PRESET_MENUS', JPATH_ADMINISTRATOR . '/components/com_menus/presets/menus.xml');
static::addPreset('components', 'JLIB_MENUS_PRESET_COMPONENTS', JPATH_ADMINISTRATOR . '/components/com_menus/presets/components.xml');
static::addPreset('users', 'JLIB_MENUS_PRESET_USERS', JPATH_ADMINISTRATOR . '/components/com_menus/presets/users.xml');

Plus additional presets could be added in a template override folder. But nothing for 3rd party. And nothing for the "Components" submenu in general.

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.

avatar alikon alikon - change - 3 Feb 2020
Status New Confirmed
avatar brianteeman
brianteeman - comment - 3 Feb 2020

@Bakual is there anything still to do here or did I address everything in my PR

avatar Bakual
Bakual - comment - 3 Feb 2020

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.

avatar brianteeman
brianteeman - comment - 3 Feb 2020

iirc quicktask is the same as the add new function in joomla 3. Was that available to extensions?

avatar brianteeman
brianteeman - comment - 3 Feb 2020

Found the answer for the dashboard

joomla/backend-template#264

avatar Bakual
Bakual - comment - 4 Feb 2020

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 ?

avatar Hackwar
Hackwar - comment - 5 Feb 2020

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.

avatar brianteeman
brianteeman - comment - 5 Feb 2020

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 :)

avatar Bakual
Bakual - comment - 5 Feb 2020

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.

avatar Bakual
Bakual - comment - 7 Feb 2020

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.

avatar Bakual
Bakual - comment - 9 Feb 2020

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.

avatar wilsonge
wilsonge - comment - 9 Feb 2020

Grab the com_modules backend model and use that. shouldn't be too hard. that will ensure the asset gets created

avatar Bakual
Bakual - comment - 9 Feb 2020

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 :)

avatar wilsonge
wilsonge - comment - 16 Feb 2020

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

avatar Bakual Bakual - change - 23 Feb 2020
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2020-02-23 13:10:42
Closed_By Bakual
avatar Bakual
Bakual - comment - 23 Feb 2020

With #28027 I think we covered everything here. Or did I miss something?

avatar Bakual Bakual - close - 23 Feb 2020
avatar brianteeman
brianteeman - comment - 23 Feb 2020

I think thats everything

Add a Comment

Login with GitHub to post a comment