Additional dashboard toolbar items/links

Permalink
Howdy,

I have been delving into having additional menu items on the dashboard toolbar. I noticed other posts regarding this, but nothing that seemed to resolve doing so.

I am able to add a custom toolbar item/link using the following in my package's controller on_start() method:

$ihm = Loader::helper( 'concrete/interface/menu' );
$ihm->addPageHeaderMenuItem(
  'gen_product',
  'Generic',
  'right',
  array(
    'href' => DIR_REL . '/index.php/dashboard/gen_product',
    'dialog-width' => '50%',
    'dialog-height' => '80%',
    'dialog-modal' => 'false'
  ),
  'gen_product'
);


The problem with this technique is that once you enter a dashboard system page, the toolbar item/link will no longer display (that is, until you return to viewing/editing pages). I'm wondering if anyone knows if this is the intended happening, and if so is there a setting to ensure the item/link stays in the toolbar even when on a dashboard system page? (in fact, if I even navigate to one of my custom dashboard pages the item/link will disappear then too)

Any ideas would be great, otherwise I'll have to make do! Thanks for your time,

-Landson

Landson
 
Remo replied on at Permalink Best Answer Reply
Remo
Yes, those links are supposed to be hidden in the dashboard, that's intention )-:
Landson replied on at Permalink Reply
Landson
thanks for the reply! Now I know not to keep searching for a solution via that route :)
Landson replied on at Permalink Reply
Landson
I found a half-decent way to add an item/link to the dashboard toolbar when on a system page. By doing the following in my package controller's on_start() method:

$html = Loader::helper( 'html' );
$v = View::getInstance();
$v->addFooterItem( $html->javascript( 'dashboard_item.js', $this->pkgHandle ) );


and then within the js file ( located at /packages/package_handle/js/dashboard_item.js ) having:

$( document ).ready( function() {
  $( '#ccm-system-nav' ).prepend( '<li><a id="ccm-nav-generic" href="/dashboard/gen_product/">Generic</a></li>' );
});


I am able to have a working dashboard toolbar item/link. The issue I'm having now is actually the opposite of before, where now my item/link won't appear when viewing or editing a page. I have delved deeper into the core files to try to see what is going on, but I haven't yet figured it out.

I'm baffled that such functionality (the addition of items/links to the dashboard toolbar) isn't available for developers. My only thought is that the core team hasn't had time to implement it.

Anyways! Thought I'd show you my findings,

-Landson
Remo replied on at Permalink Reply
Remo
Well, I'm not sure you want to go there.. You can certainly hack everything together, but if you try to release an add-on like this you'll probably have a few support requests sooner or later.

So far there haven't been many add-ons in the marketplace where such a functionality would make sense. But I think a github pull request for a change like this would be accepted...