0
0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2024-12-22 12:28:31 +00:00
salesagility_SuiteCRM/include/Smarty/plugins/function.sugar_fetch.php
Dillon-Brown acf296012d Revert "Merge branch 'hotfix' into develop"
This reverts commit d08f74643d, reversing
changes made to b137595f91.
2018-07-31 15:24:44 +01:00

62 lines
1.4 KiB
PHP
Executable File

<?php
/*
Modification information for LGPL compliance
r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
r53409 - 2010-01-03 19:31:15 -0800 (Sun, 03 Jan 2010) - roger - merge -r50376:HEAD from fuji_newtag_tmp
*/
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty {sugar_fetch} function plugin
*
* Type: function<br>
* Name: sugar_fetch<br>
* Purpose: grabs the requested index from either an object or an array
*
* @author Rob Aagaard {rob at sugarcrm.com}
* @param array
* @param Smarty
*/
function smarty_function_sugar_fetch($params, &$smarty)
{
if(empty($params['key'])) {
$smarty->trigger_error("sugar_fetch: missing 'key' parameter");
return;
}
if(empty($params['object'])) {
$smarty->trigger_error("sugar_fetch: missing 'object' parameter");
return;
}
$theKey = $params['key'];
if(is_object($params['object'])) {
$theData = $params['object']->$theKey;
} else {
$theData = $params['object'][$theKey];
}
if(!empty($params['assign'])) {
$smarty->assign($params['assign'],$theData);
} else {
return $theData;
}
}