Sugar 7 : how to remove subpanel row_action button on bwc record ?

Hello everyone !

To follow my adventures with panel-top buttons (from here : https://community.sugarcrm.com/ideas/1457#comment-1813 ), I'm struggling with a module 7 subpanel on a bwc record.

What i have :

I've created a custom module through module builder called "ag_ActesDeGestion", so it is built following version 7's intelligence. it is linked with the Contracts module (which is a legacy module) by : Contracts 1-M ag_ActesDeGestion.

So, in a Contract's record, i have a ag_ActesDeGestion subpanel. In bwc display.

What i want :

Making the row action buttons disappear from every line of this subpanel.

What i've tried :

In  custom/Extension/modules/Contracts/Ext/Layoutdefs/contracts_ag_actesdegestion_1_Contracts.php I've tried this :

<?php

// created: 2015-06-12 05:52:53

$layout_defs["Contracts"]["subpanel_setup"]['contracts_ag_actesdegestion_1'] = array (

  'order' => 100,

  'module' => 'ag_ActesDeGestion',

  'subpanel_name' => 'default',

  'sort_order' => 'asc',

  'sort_by' => 'id',

  'title_key' => 'LBL_CONTRACTS_AG_ACTESDEGESTION_1_FROM_AG_ACTESDEGESTION_TITLE',

  'get_subpanel_data' => 'contracts_ag_actesdegestion_1',

  'top_buttons' =>

  array (

    0 =>

    array (

      'widget_class' => 'SubPanelTopButtonQuickCreate',

    ),

  ),

  'list_fields' =>  array(

     'edit_button'=> array(

  'vname' => 'LBL_EDIT_BUTTON',

  'widget_class' => 'SubPanelEditButton',

  'module' => 'Contracts',

  'width' => '5%',

  'css_class'=>'disabled',

  ),

  /*'remove_button'=> array(

  'vname' => 'LBL_REMOVE',

  'widget_class' => 'SubPanelRemoveButton',

  'module' => 'Contracts',

  'width' => '5%',

  'css_class'=>'disabled',

  ),*/

  ),

);

But it does not work.

Which widget_class does they use?

Where can i find these widget classes ?

What file have i to modify ?

By advance, thanks a lot for your help and knowledges.

Parents
  • Hi

    <?php

    $viewdefs['Contracts']['base']['view']['contracts_ag_actesdegestion_1'] = array (

    //our line added

    'rowactions' => array(

            'actions' => array(

                array(

                    'type' => 'rowaction',

                    'css_class' => 'btn',

                    'tooltip' => 'LBL_PREVIEW',

                    'event' => 'list:preview:fire',

                    'icon' => 'fa-eye',

                    'acl_action' => 'view',

                    'allow_bwc' => false,

                ),

                array(

                    'type' => 'rowaction',

                    'name' => 'edit_button',

                    'icon' => 'fa-pencil',

                    'label' => 'LBL_EDIT_BUTTON',

                    'event' => 'list:editrow:fire',

                    'acl_action' => 'edit',

                    'allow_bwc' => true,

                  

                ),

                array(

                    'type' => 'unlink-action',

                    'icon' => 'fa-chain-broken',

                    'label' => 'LBL_UNLINK_BUTTON',

                     'css_class'=>'disabled',

                ),

            ),

        ),

    //our added lines ends here

      'panels' =>

                     //fields

                     //by default

      ),

      'type' => 'subpanel-list',

    );

    FYI : I have copied rowactions array from subpanel-list.php and pasted here.And added css_class for our button.

    Hope it helps.

    Thanks!.

  • Hello Ajay Kumar!

    Thanks a lot for your answer.

    I've tested it, but it does absolutely nothing.

    You understood what i wanted to do (aka remove/disable "unlink" button in subpanel), but misunderstood my situation :

    My application is in version 7.5.2.1. So, the Contracts module is a legacy module. Aka, it uses the core of Sugar 6.

    I show you below what it looks like :

    As you can see, i've opened the ag_ActesDeGestion subpanel, and you can notice the "see" and the "unlink" buttons in the row of the element.

    This is the image after trying your way, by doing the following :

    Create the folder and file in

    /custom/modules/Contracts/clients/base/views/contracts_ag_actesdegestion_1/contracts_ag_actesdegestion_1.php

    (there were no "contracts_ag_actesdegestion_1" folder in views)

    then copy/paste your code (by correcting the missing "array(" in the 'panels' seciton) :

    <?php

    $viewdefs['Contracts']['base']['view']['contracts_ag_actesdegestion_1'] = array (

    //our line added

    'rowactions' => array(

            'actions' => array(

                array(

                    'type' => 'rowaction',

                    'css_class' => 'btn',

                    'tooltip' => 'LBL_PREVIEW',

                    'event' => 'list:preview:fire',

                    'icon' => 'fa-eye',

                    'acl_action' => 'view',

                    'allow_bwc' => false,

                ),

                array(

                    'type' => 'rowaction',

                    'name' => 'edit_button',

                    'icon' => 'fa-pencil',

                    'label' => 'LBL_EDIT_BUTTON',

                    'event' => 'list:editrow:fire',

                    'acl_action' => 'edit',

                    'allow_bwc' => true,

                 

                ),

               /* array(

                    'type' => 'unlink-action',

                    'icon' => 'fa-chain-broken',

                    'label' => 'LBL_UNLINK_BUTTON',

                     'css_class'=>'disabled',

                ),*/

            ),

        ),

    //our added lines ends here

      'panels' => array(

                     //fields

                     //by default

      ),

      'type' => 'subpanel-list',

    );

    Even by commenting the button i did not want to see.

    And then, do a Quick Repair and Rebuild.

    So, it did absolutely nothing.

    And i think because Sugar 6 / legacy modules does not work as in v7. The subpanels showed in  a bwc modules are coded with v6 intelligence. So they use the same kind of things.

    I know for example that panel-top buttons are coded like this :

    'top_buttons' =>

      array (

        0 =>

        array (

          'widget_class' => 'SubPanelTopSelectButton',

          'mode' => 'MultiSelect',

        ),

        1 =>

        array (

          'widget_class' => 'SubPanelTopButtonQuickCreate',

        ),

      ),

    They are using widget_class.

    So, i would like to find which widget_class is used for row_buttons, how is the array named, and which file i have to modify.

    Thanks a lot for your time though, i really appreciate this!

    And if you have a new idea, or some clue, i'll be gratefull : )

    Thank you

Reply
  • Hello Ajay Kumar!

    Thanks a lot for your answer.

    I've tested it, but it does absolutely nothing.

    You understood what i wanted to do (aka remove/disable "unlink" button in subpanel), but misunderstood my situation :

    My application is in version 7.5.2.1. So, the Contracts module is a legacy module. Aka, it uses the core of Sugar 6.

    I show you below what it looks like :

    As you can see, i've opened the ag_ActesDeGestion subpanel, and you can notice the "see" and the "unlink" buttons in the row of the element.

    This is the image after trying your way, by doing the following :

    Create the folder and file in

    /custom/modules/Contracts/clients/base/views/contracts_ag_actesdegestion_1/contracts_ag_actesdegestion_1.php

    (there were no "contracts_ag_actesdegestion_1" folder in views)

    then copy/paste your code (by correcting the missing "array(" in the 'panels' seciton) :

    <?php

    $viewdefs['Contracts']['base']['view']['contracts_ag_actesdegestion_1'] = array (

    //our line added

    'rowactions' => array(

            'actions' => array(

                array(

                    'type' => 'rowaction',

                    'css_class' => 'btn',

                    'tooltip' => 'LBL_PREVIEW',

                    'event' => 'list:preview:fire',

                    'icon' => 'fa-eye',

                    'acl_action' => 'view',

                    'allow_bwc' => false,

                ),

                array(

                    'type' => 'rowaction',

                    'name' => 'edit_button',

                    'icon' => 'fa-pencil',

                    'label' => 'LBL_EDIT_BUTTON',

                    'event' => 'list:editrow:fire',

                    'acl_action' => 'edit',

                    'allow_bwc' => true,

                 

                ),

               /* array(

                    'type' => 'unlink-action',

                    'icon' => 'fa-chain-broken',

                    'label' => 'LBL_UNLINK_BUTTON',

                     'css_class'=>'disabled',

                ),*/

            ),

        ),

    //our added lines ends here

      'panels' => array(

                     //fields

                     //by default

      ),

      'type' => 'subpanel-list',

    );

    Even by commenting the button i did not want to see.

    And then, do a Quick Repair and Rebuild.

    So, it did absolutely nothing.

    And i think because Sugar 6 / legacy modules does not work as in v7. The subpanels showed in  a bwc modules are coded with v6 intelligence. So they use the same kind of things.

    I know for example that panel-top buttons are coded like this :

    'top_buttons' =>

      array (

        0 =>

        array (

          'widget_class' => 'SubPanelTopSelectButton',

          'mode' => 'MultiSelect',

        ),

        1 =>

        array (

          'widget_class' => 'SubPanelTopButtonQuickCreate',

        ),

      ),

    They are using widget_class.

    So, i would like to find which widget_class is used for row_buttons, how is the array named, and which file i have to modify.

    Thanks a lot for your time though, i really appreciate this!

    And if you have a new idea, or some clue, i'll be gratefull : )

    Thank you

Children
  • Ok. Can you check the file in below path

    /custom/modules/ag_ActesDeGestion/metadata/subpanels/Contract_subpanel_contracts_ag_ActesDeGestion_1.php

    If this file is not there goto admin->studio->Contracts>subpanel->select "ag_ActesDeGestion".

    Then save and deploy.

    It will create one file

    you can modify this file .

    widget class for remove button same as you used - SubPanelRemoveButton

    Button Array is below,

    'remove_button' =>

      array (

        'vname' => 'LBL_REMOVE',

        'widget_class' => 'SubPanelRemoveButton',

         'module' => 'Contacts',

        'width' => '10%',

        'default' => true,

      ),

    just comment this button array.It will work.

    Thanks!.