Skip to content

Instantly share code, notes, and snippets.

@mmarum-sugarcrm
Last active December 14, 2015 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmarum-sugarcrm/0427aa0b3d0811fd44b6 to your computer and use it in GitHub Desktop.
Save mmarum-sugarcrm/0427aa0b3d0811fd44b6 to your computer and use it in GitHub Desktop.
Adding a custom button to Sugar 7 Accounts Record view using metadata
<?php
/**
* Copyright 2015 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
//Insert our custom button definition into existing Buttons array before the sidebar toggle button
array_splice($viewdefs['Accounts']['base']['view']['record']['buttons'], -1, 0, array(
array(
'name' => 'custom_button',
'type' => 'button',
'label' => 'My Custom Button',
'css_class' => 'btn-link',
//Set target object for Sidecar Event.
//By default, button events are triggered on current Context but can optionally set target to 'view' or 'layout'
//'target' => 'context'
'events' => array(
// custom Sidecar Event to trigger on click. Event name can be anything you want.
'click' => 'button:custom_button:click',
)
),
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment