From 64967ca1433903a4e47125c243143401ce048dd8 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 2 Dec 2015 20:37:40 -0500 Subject: [PATCH] Cleanup smarty_function_crmScript --- CRM/Core/Smarty/plugins/function.crmScript.php | 17 +++++++---------- templates/CRM/Contribute/Form/Selector.tpl | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CRM/Core/Smarty/plugins/function.crmScript.php b/CRM/Core/Smarty/plugins/function.crmScript.php index d1e336029f..716a8a941d 100644 --- a/CRM/Core/Smarty/plugins/function.crmScript.php +++ b/CRM/Core/Smarty/plugins/function.crmScript.php @@ -48,20 +48,17 @@ * @throws Exception */ function smarty_function_crmScript($params, &$smarty) { - $res = CRM_Core_Resources::singleton(); - - if (empty($params['weight'])) { - $params['weight'] = CRM_Core_Resources::DEFAULT_WEIGHT; - } - if (empty($params['region'])) { - $params['region'] = CRM_Core_Resources::DEFAULT_REGION; - } + $params += array( + 'weight' => CRM_Core_Resources::DEFAULT_WEIGHT, + 'region' => CRM_Core_Resources::DEFAULT_REGION, + 'ext' => 'civicrm', + ); if (array_key_exists('file', $params)) { - $res->addScriptFile($params['ext'], $params['file'], $params['weight'], $params['region']); + Civi::resources()->addScriptFile($params['ext'], $params['file'], $params['weight'], $params['region']); } elseif (array_key_exists('url', $params)) { - $res->addScriptUrl($params['url'], $params['weight'], $params['region']); + Civi::resources()->addScriptUrl($params['url'], $params['weight'], $params['region']); } else { CRM_Core_Error::debug_var('crmScript_params', $params); diff --git a/templates/CRM/Contribute/Form/Selector.tpl b/templates/CRM/Contribute/Form/Selector.tpl index 0264241504..b2994bb0fc 100644 --- a/templates/CRM/Contribute/Form/Selector.tpl +++ b/templates/CRM/Contribute/Form/Selector.tpl @@ -103,5 +103,5 @@ {/strip} {include file="CRM/common/pager.tpl" location="bottom"} -{crmScript ext='civicrm' file='js/crm.expandRow.js'} +{crmScript file='js/crm.expandRow.js'} -- 2.25.1