HOWTO: How to hide a dashlet from the 'Add Dashlets' dialog in an upgrade-safe way

sugarcrmdevelopers —  August 11, 2011 — 7 Comments

If you want to remove a dashlet from being available in the application, the easiest way is to simple delete the dashlet’s directory and it will cease to be available. But like any good Sugar developer knows, the better approach is always upgrade-safe one ( which deleting files from your base install definitely isn’t ). This forums poster was looking for this kind of solution, and here’s a way you could do it.

Let’s say you want to remove the Invaders! dashlet from being able to be added. First off, you’ll need to create a new directory named custom/modules/Home/Dashlets/InvadersDashlet/ where we will put all the customized files for doing this. We need to create two stub files so that our customization is picked up. The first is for the main dashlet class itself, name it InvadersDashlet.php and put the following in it:

<?php

require_once('modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.php');

class CustomInvadersDashlet extends InvadersDashlet {}

Next is the language file for the dashlet ( InvadersDashlet.en_us.lang.php ), which will simply just include in the non-customized one.

<?php
require_once('modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.en_us.lang.php');

Finally, we’ll add the metadata file ( InvadersDashlet.meta.php ) which will hold our customization. For this, we’ll set the hidden attribute of the dashletmeta properties to false so that the Dashlet won’t appear for adding.

<?php

require_once('modules/Home/Dashlets/InvadersDashlet/InvadersDashlet.meta.php');

$dashletMeta['InvadersDashlet']['hidden'] = true;

Finally, do a Quick Rebuild and Repair and then next time you go to the ‘Add Dashlets’ screen the dashlet won’t appear.

7 responses to HOWTO: How to hide a dashlet from the 'Add Dashlets' dialog in an upgrade-safe way

  1. 

    Thanks, this is what i was searching for!

  2. 

    Any ideas how to disable the news dashlet in an upgrade safe way? this doesn’t work for the Iframe or sugarnews dashlet

  3. 

    There is a problem with these instructions for version 6.5.11+. The revisions to the dashlet system seem to break these instructions somewhat. The fix I had to put into place was to add a ‘dashlets.php’ file into the root directory of /custom/modules/home. This dashlets.php file contains additional configuration data and can be copied from /modules/home and customized to remove any reference to the unwanted dashlet.

  4. 

    Thanks! Helped me alot!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s