How to remove preview button from subpanel

Hello,

I am using sugar Enterprise.

I am unable to remove preview button(eye button) from subpanel. My requirement is to remove preview button only from account module's subpanel contacts.

Thank You

  • What you need is to set 

    'css_class' => 'disabled'

    for the preview rowactions on the Contacts module's subpanel

    If you have customized that subpanel from studio you should have this file already in your system:

    custom/modules/Contacts/clients/base/views/subpanel-for-accounts/subpanel-for-accounts.php 

    if not you can create it by making a small modification via studio (like removing or adding a column to the subpanel in question) or copying the original to your custom directory. 

    modules/Contacts/clients/base/views/subpanel-for-accounts/subpanel-for-accounts.php 

    your viewdef will most likely include only the panels, not the rowactions, that's because it is using the default rowactions from

    clients/base/views/subpanel-list/subpanel-list.php

    which looks something like:

        'rowactions' => array(
            'actions' => array(
                array(
                    'type' => 'rowaction',
                    'css_class' => 'btn',
                    'tooltip' => 'LBL_PREVIEW',
                    'event' => 'list:preview:fire',
                    'icon' => 'fa-eye',
                    'acl_action' => 'view',
                ),
                array(
                    'type' => 'rowaction',
                    'name' => 'edit_button',
                    'icon' => 'fa-pencil',
                    'label' => 'LBL_EDIT_BUTTON',
                    'event' => 'list:editrow:fire',
                    'acl_action' => 'edit',
                ),
                array(
                    'type' => 'unlink-action',
                    'name' => 'unlink_button',
                    'icon' => 'fa-chain-broken',
                    'label' => 'LBL_UNLINK_BUTTON',
                ),
            ),
        ),
    

    If you copied clients/base/views/subpanel-list/subpanel-list.php to your custom directory custom/modules/Contacts/clients/base/views/subpanel-list/subpanel-list.php and modified that, the modifications would apply to all of the default Contacts subpanels.

    By overriding the rowactions in the specific subpanel-for-accounts you are modifying the rowactions only on the Contacts subpanel under Accounts.

    So your custom/modules/Contacts/clients/base/views/subpanel-for-accounts/subpanel-for-accounts.php

    will look something like:

    $viewdefs['Contacts']['base']['view']['subpanel-for-accounts'] = array(
      'type' => 'subpanel-list',
      'panels' =>
      array(
        array(
          'name' => 'panel_header',
          'label' => 'LBL_PANEL_1',
          'fields' =>
          array(
            array(
                'name' => 'name',
                'type' => 'fullname',
                'fields' => array(
                    'salutation',
                    'first_name',
                    'last_name',
                ),
                'link' => true,
              'label' => 'LBL_LIST_NAME',
              'enabled' => true,
              'default' => true,
            ),
            array(
              'name' => 'primary_address_city',
              'label' => 'LBL_LIST_CITY',
              'enabled' => true,
              'default' => true,
            ),
            array(
              'name' => 'primary_address_state',
              'label' => 'LBL_LIST_STATE',
              'enabled' => true,
              'default' => true,
            ),
            array(
              'name' => 'email',
              'label' => 'LBL_LIST_EMAIL',
              'enabled' => true,
              'default' => true,
            ),
            array(
              'name' => 'phone_work',
              'label' => 'LBL_LIST_PHONE',
              'enabled' => true,
              'default' => true,
            ),
          ),
        ),
      ),
    )
      'rowactions' =>
      array (
        'actions' =>
        array (
          0 =>
          array (
            'type' => 'rowaction',
            'css_class' => 'btn',
            'tooltip' => 'LBL_PREVIEW',
            'event' => 'list:preview:fire',
            'icon' => 'fa-eye',
            'acl_action' => 'view',
            'allow_bwc' => false,
            'css_class' => 'disabled'
          ),
          1 =>
          array (
            'type' => 'rowaction',
            'name' => 'edit_button',
            'icon' => 'fa-pencil',
            'label' => 'LBL_EDIT_BUTTON',
            'event' => 'list:editrow:fire',
            'acl_action' => 'edit',
            'allow_bwc' => true,
          ),
          2 =>
          array (
            'type' => 'rowaction',
            'name' => 'set_hq_addrss',
            'icon' => 'fa-ok',
            'label' => 'LBL_SET_HQ_ADDRESS',
            'event' => 'list:sethqaddress:fire',
            'acl_action' => 'edit',
            'allow_bwc' => false,
          ),
        ),
      ),
      'panels' =>
    

    This code is not tested, so check the syntax :)

    Francesca