Custom Module EditViewDef.php Difference

Hi there,

I’ve been doing some tweaking on SuiteCRM and came across this particular difference in code between different modules.

Query 1: What is the difference, if any between the below codes?
Query 2: Would there be any impact if I were to make Code 2 = Code 1?

Code 1 => Contact Module, EditViewDef.php in custom/modules/Contacts/metadata/

  'LBL_PANEL_ASSIGNMENT' => 
  array (
    0 => 
    array (
      0 => 
      array (
        'name' => 'assigned_user_name',
        'label' => 'LBL_ASSIGNED_TO_NAME',
      ),
    ),
  ),

Code 2 => Tasks Module, EditViewDef.php in custom/modules/Tasks/metadata/

  'LBL_PANEL_ASSIGNMENT' => 
  array (
    0 => 
    array (
      0 => 'assigned_user_name',
    ),
  ),

Any advise would be greatly appreciated.

Calvin

Hi Calvin,

These are pretty much equivalent. The only difference is that the more verbose one is explicitly setting a label. Provided that the module you are changing has this label (in this case Tasks has a label ‘LBL_ASSIGNED_TO_NAME’) then it’s fine to change these. However if the views are working as you expect it’s fine to leave it alone also.

Thanks,
Jim

1 Like

Hi Jim,

Thanks for explaining. I tried to append the following code to the Tasks module yet it doesn’t do what it’s supposed to do. Works well if I append it into the Contact module after the label, so I’m not sure why?

			
			'displayParams' => array( 
			  'hideButtons' => true, 
			),  

Calvin

Hi Calvin, The following should work.


'LBL_PANEL_ASSIGNMENT' => 
      array (
        0 => 
        array (
          0 => 
          array (
            'name' => 'assigned_user_name',
            'label' => 'LBL_ASSIGNED_TO_NAME',
            'displayParams' => array( 
		'hideButtons' => true, 
	     ), 
          ),
        ),
      ),

What is it that you are trying to achieve and what do you see instead?

Hi Jim,

I’m basically hiding the Select & Clear buttons for Assigned To. Tried what you suggested earlier and still couldn’t hide them.

So far this doesn’t work for Projects and Events modules. (EditViewDef.php)

Calvin

Hi Calvin,

Tested this and was receiving the same results. This was because the arrays were missing one level so the displayParams weren’t getting picked up. Try the following (commented for clarity):


	  'LBL_PANEL_ASSIGNMENT' => array(//Start panel
	        array(//Start row
                    array(//Start assigned user item
		        'name'=>'assigned_user_name',
                        'label' => 'LBL_ASSIGNED_TO',
                        'displayParams' => array(
                            'hideButtons' => true,
                        ),
                ),
                array(),//Extra row item so that assigned user input sits nicely
            )
	  ),

Hope this helps,
Jim

1 Like

Hi Jim,

Perfect. :cheer:

Thanks a ton for the coding help.

Calvin