Last active
December 14, 2015 05:29
-
-
Save blak3r/5035577 to your computer and use it in GitHub Desktop.
Example of how to use SugarLogic to SetPanelVisibility (ie toggle a panel on and off) http://developers.sugarcrm.com/wordpress/2011/06/13/learning-sugar-logic-using-custom-dependencies/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dependencies['Cases']['panel_visibility'] = array( | |
'hooks' => array("edit"), | |
'trigger' => 'equal($status, "Closed")', //Optional, the trigger for the dependency. Defaults to 'true'. | |
'triggerFields' => array('status'), | |
'onload' => true, | |
//Actions is a list of actions to fire when the trigger is true | |
'actions' => array( | |
array( | |
'name' => 'SetPanelVisibility', | |
'params' => array( | |
'target' => 'detailpanel_2', // <-- get this by doing inspect element on the page, they're sequential though so can probably guess it. | |
'value' => 'true', | |
), | |
) | |
), | |
'notActions' => array( | |
array( | |
'name' => 'SetPanelVisibility', | |
'params' => array( | |
'target' => 'detailpanel_2', | |
'value' => 'false', | |
), | |
), | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just a note that if you want the visibility to work on detail view then you add an item to the hooks array titled "view". I had thought it was detail, but was wrong. Thanks for the gist blake!