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:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    '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',
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    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:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    $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,
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

    Francesca