Under Review

SugarCRM7 HOW TO:  Manipulate Subpanel Top Buttons (Actions)

To Manipulate Top buttons (Actions) for a module’s “default” subpanel

 In 

<sugar_root>/custom/Extension/modules/<module>/Ext/clients/base/views/panel-top/panel-top.php



Redefine the top buttons  adding/removing as needed.

   

E.g. to remove the ability to “Link”  an exising record add 

'css_class' => 'disabled' to the  button definition:

        $viewdefs['<the subpanel module>']['base']['view']['panel-top']['buttons']=array(
         array(
            'type' => 'button',
            'css_class' => 'btn-invisible',
            'icon' => 'icon-chevron-up',
            'tooltip' => 'LBL_TOGGLE_VISIBILITY',
         ),
         array(
             'type' => 'actiondropdown',
            'name' => 'panel_dropdown',
            'css_class' => 'pull-right',
            'buttons' => array(
                array(
                    'type' => 'sticky-rowaction',
                    'icon' => 'icon-plus',
                    'name' => 'create_button',
                    'label' => ' ',
                    'acl_action' => 'create',
                    'tooltip' => 'LBL_CREATE_BUTTON_LABEL',
                ),
                array(
                    'type' => 'link-action',
                    'name' => 'select_button',
                    'label' => 'LBL_ASSOC_RELATED_RECORD',
                    'css_class'=>'disabled',
                ),
             ),
         ),
);                                                                                                                   

 

   

To Manipulate Top buttons (Actions) for a  subpanel on a specific module.

   

 In the definition for the subpanel for  the module in 

<sugar_root>/custom/Extension/modules/<module>/Ext/clients/base/layouts/subpanels/<yourfilename>.php

   

 add:

   

 'override_paneltop_view' => 'panel-top-for-<module>',

       

For example, to override the panel-top for the "customer visits" subpanel on Accounts:

        $viewdefs['Accounts']['base']['layout']['subpanels']['components'][]  = array (
   'layout'=>'subpanel',
   'label' => 'LBL_CUSTV_CUSTOMER_VISITS_ACCOUNTS_TITLE',
   'override_paneltop_view' => 'panel-top-for-custv_customer_visits',
   'context' => array(
      'link' => 'custv_customer_visits_accounts',
   )
);                                   

Then in

   

<sugar_root>/custom/modules/<module>/clients/base/view

   

create a directory panel-top-for-<lower_case_related_module>

   

and a file inside that:  panel-top-for-<lower_case_related_module>.php

       

For Example for the Customer Visits  example:

   

<sugar_root>/custom/modules/Accounts/clients/base/view/panel-top-for-custv_customer_visits/panel-top-for-custv_customer_visits.php

       

There define the view and add a css-class and/or other changes as needed:

$viewdefs['Accounts']['base']['view']['panel-top-for-custv_customer_visits'] = array(
     'type' => 'panel-top',
     'buttons' => array(
        //shows.hides supanel as the chevron is  toggled
         array(
            'type' => 'button',
            'css_class' => 'btn-invisible',
            'icon' => 'icon-chevron-up',
            'tooltip' => 'LBL_TOGGLE_VISIBILITY',
         ),
         array(
        //the dropdown composed of [+]and  Actions chevron
            'type' => 'actiondropdown',
            'name' => 'panel_dropdown',
            'css_class' => 'pull-right',
            'buttons' => array(
                //the [+] button to create a  new record related
                //to the parent we are on (was Create in  6.5.x)
                array(
                    'type' => 'sticky-rowaction',
                    'icon' => 'icon-plus',
                    'name' => 'create_button',
                    'label' => ' ',
                     'acl_action' => 'create',
                    'tooltip' => 'LBL_CREATE_BUTTON_LABEL',
                ),
               //to Link an existing record  to
               //the parent we are on (was  Select in 6.5.x)
               array(
                     'type' => 'link-action',
                    'name' => 'select_button',
                    'label' => 'LBL_ASSOC_RELATED_RECORD',
                    'css_class' => 'disabled',
                ),
            ),
         ),
     ),
);                                                                                                                                                                                         

Critique Welcome

FrancescaS