Hide Select and Cancel buttons from Relate type fields

sugarcrmdevelopers —  March 5, 2013
Greetings!

To Do: Hide select and cancel buttons from relate type field.

Before
After

Step 1: To make it happen, you first need to check if you have a file editviewdefs.php under custom/modules/<Desired_module>/metadata/ if not, go to Admin > Studio > <Desired_module> > Layout > Edit View > and press Save and Deploy.

Then you will see that  custom/modules/<Desired_module>/metadata/ has editviewdefs.php in it. Open it and search for the field you want to hide those buttons.

If the field is defined in following manner,

0 => ‘<YOUR_FIELD_NAME>’,

Then you need to change it to,

0 => array(‘name’ => ‘<YOUR_FIELD_NAME>’,
‘displayParams’ => array(‘hide_Buttons’ => true,)),

If your field is already an array like,

0 =>
          array (
            ‘name’ => ‘<YOUR_FIELD_NAME>’,
            ‘studio’ => ‘visible’,
            ‘label’ => ‘<LBL_YOUR_FIELD_NAME>’,
),

 just add following line in that array

‘displayParams’ => array(‘hide_Buttons’ => true,)

So it should look like following at the end

0 =>
          array (
            ‘name’ => ‘<YOUR_FIELD_NAME>’,
            ‘studio’ => ‘visible’,
            ‘label’ => ‘<LBL_YOUR_FIELD_NAME>’,
            ‘displayParams’ => array(‘hideButtons’ => true),
          ),

Step 2: Go to Admin > Repair > Quick Repair and Rebuild. And done!

Feel free to leave comments below.