This commit is contained in:
2023-07-12 16:26:59 +03:00
parent 7a05dce161
commit 34f97c4e5e
-30
View File
@@ -1,30 +0,0 @@
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
//$templatePath = app()->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);