service()->templater()->getComponent('kit')->getTemplatePath(); $templatePath = app()->service()->templater()->getPath() . '/kit/templates'; $templateSvgPath = $templatePath; $GLOBALS['bx_assets_template_list'] = []; function scanTemplates($path, $basePath, $recursive = false){ $tree = glob($path . '/*.php'); foreach ((array)$tree as $t) { $templateName = ltrim(substr($t, strlen($basePath), strlen($t) - strlen($basePath) - 4), "/"); $GLOBALS['bx_assets_template_list'][] = 'kit:'.$templateName; } if($recursive) { $treeDir = glob($path . '/*', GLOB_ONLYDIR); foreach ($treeDir as $dir) { scanTemplates($dir, $basePath, true); } } } scanTemplates($templateSvgPath, $templatePath, true); $str = ''; foreach ($GLOBALS['bx_assets_template_list'] as $item){ $str .= "'{$item}'," . PHP_EOL; } pre($str, 0);