mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
30 lines
1001 B
PHP
30 lines
1001 B
PHP
<?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); |