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!.

Reply
  • 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!.

Children
  • 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

  • Hi Gaelle,

    I just found a method that seems to work, at least for me. I did a test for Quotes where subpanel is documents.

    I create an layout def in Quotes:

    on custom/Extension/modules/Quotes/Ext/Layoutdefs/documents_quotes_Quotes.php

    In this file I select my custom subpanel definition:

    $layout_defs["Quotes"]["subpanel_setup"]['documents'] = array(

    ...

    'subpanel_name' => 'ForQuotes',

    ...

    );

    In create my special layout in modules/Documents/metadata/subpanels/ForQuotes.php

    ForQuotes is actually a copy of ForContractType where buttons code is commented.

    I've commented the code for edit_button and remove_button:

    $subpanel_layout = array(

    ...

      /*'edit_button'=>array(

      'vname' => 'LBL_EDIT_BUTTON',

      'widget_class' => 'SubPanelEditButton',

      'module' => 'Documents',

      'width' => '5%',

      ),

      'remove_button'=>array(

      'vname' => 'LBL_REMOVE',

      'widget_class' => 'SubPanelRemoveButton',

      'module' => 'Documents',

      'width' => '5%',

      ),

    ..*/

    );

    After did a QuickRepair and got Documents subpanel without edit/remove buttons.

    You can change for test purposes realtime these subpanels names (default, ForQuotes, etc) after repair playing with ext file

    custom/modules/Quotes/Ext/Layoutdefs/layoutdefs.ext.php

    Try to do the same with your module. Has to work