1: <?php
2: /**
3: * XOOPS addBaseScriptAsset() via Smarty template
4: *
5: * @copyright 2015 XOOPS Project (http://xoops.org)
6: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
7: * @author Richard Griffith <richard@geekwright.com>
8: */
9:
10: /**
11: * Add one or more scripts to the base script asset
12: *
13: * @param string $params commas separated list of script assets
14: * @param Smarty_Internal_Template $smarty passed by smarty
15: *
16: * @return string
17: */
18: function smarty_function_addBaseScript($params, Smarty_Internal_Template $smarty)
19: {
20: $xoops = Xoops::getInstance();
21: $assets = [];
22: if (isset($params['assets'])) {
23: $assets = explode(',', $params['assets']);
24: }
25: if (!empty($assets)) {
26: $xoops->theme()->addBaseScriptAssets($assets);
27: }
28: return '';
29: }
30: