- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/component_template.php
- Класс: CBitrixComponentTemplate
- Вызов: CBitrixComponentTemplate::generatePossibleTemplatePath
public function generatePossibleTemplatePath(): array
{
$component = $this->getComponent();
$arFolders = [];
$relativePath = $component->GetRelativePath();
$parentComponent = $component->GetParent();
$siteTemplate = $component->getSiteTemplateId();
$defSiteTemplate = ($siteTemplate == ".default");
$parentTemplatePath = '';
$parentRelativePath = '';
if($parentComponent && $parentComponent->GetTemplate())
{
$parentRelativePath = $parentComponent->GetRelativePath();
$parentTemplateName = $parentComponent->GetTemplate()->GetName();
if($parentTemplateName <> '')
{
$parentTemplatePath = "/".$parentTemplateName;
}
if(!$defSiteTemplate)
{
$arFolders[] = array(
"path" => "/local/templates/" . $siteTemplate . "/components" . $parentRelativePath . $parentTemplatePath . $relativePath,
"in_theme" => true,
);
}
$arFolders[] = array(
"path" => "/local/templates/.default/components" . $parentRelativePath . $parentTemplatePath . $relativePath,
"in_theme" => true,
"site_template" => ".default",
);
$arFolders[] = array(
"path" => "/local/components" . $parentRelativePath . "/templates" . $parentTemplatePath . $relativePath,
"in_theme" => true,
"site_template" => "",
);
}
if(!$defSiteTemplate)
{
$arFolders[] = array(
"path" => "/local/templates/" . $siteTemplate . "/components" . $relativePath,
);
}
$arFolders[] = array(
"path" => "/local/templates/.default/components" . $relativePath,
"site_template" => ".default",
);
$arFolders[] = array(
"path" => "/local/components" . $relativePath . "/templates",
"site_template" => "",
);
if($parentComponent)
{
if(!$defSiteTemplate)
{
$arFolders[] = array(
"path" => BX_PERSONAL_ROOT . "/templates/" . $siteTemplate . "/components" . $parentRelativePath . $parentTemplatePath . $relativePath,
"in_theme" => true,
);
}
$arFolders[] = array(
"path" => BX_PERSONAL_ROOT . "/templates/.default/components" . $parentRelativePath . $parentTemplatePath . $relativePath,
"in_theme" => true,
"site_template" => ".default",
);
$arFolders[] = array(
"path" => "/bitrix/components" . $parentRelativePath . "/templates" . $parentTemplatePath . $relativePath,
"in_theme" => true,
"site_template" => "",
);
}
if(!$defSiteTemplate)
{
$arFolders[] = array(
"path" => BX_PERSONAL_ROOT . "/templates/" . $siteTemplate . "/components" . $relativePath,
);
}
$arFolders[] = array(
"path" => BX_PERSONAL_ROOT . "/templates/.default/components" . $relativePath,
"site_template" => ".default",
);
$arFolders[] = array(
"path" => "/bitrix/components" . $relativePath . "/templates",
"site_template" => "",
);
return $arFolders;
}