- Модуль: translate
- Путь к файлу: ~/bitrix/modules/translate/lib/index/pathindex.php
- Класс: BitrixTranslateIndexPathIndex
- Вызов: PathIndex::detectAssignment
public function detectAssignment(): ?string
{
$path = $this->getPath();
// /bitrix/mobileapp/[moduleName]
// /bitrix/templates/[templateName]
// /bitrix/components/bitrix/[componentName]
// /bitrix/activities/bitrix/[activityName]
// /bitrix/wizards/bitrix/[wizardsName]
// /bitrix/gadgets/bitrix/[gadgetName]
// /bitrix/js/[moduleName]/[smth]
foreach (TranslateASSIGNMENT_TYPES as $testEntry)
{
$testPath = '/bitrix/'. $testEntry;
if (mb_strpos($path, $testPath.'/') === 0 || $path == $testPath)
{
return $testEntry;
}
}
$assignment = null;
$moduleName = $this->detectModuleId();
if ($moduleName !== null)
{
$assignment = 'modules';
foreach (TranslateASSIGNMENT_TYPES as $testEntry)
{
// /bitrix/modules/[moduleName]/install/mobileapp/[moduleName]
// /bitrix/modules/[moduleName]/install/templates/[templateName]
// /bitrix/modules/[moduleName]/install/components/bitrix/[componentName]
// /bitrix/modules/[moduleName]/install/activities/bitrix/[activityName]
// /bitrix/modules/[moduleName]/install/wizards/bitrix/[wizardsName]
// /bitrix/modules/[moduleName]/install/gadgets/bitrix/[gadgetName]
// /bitrix/modules/[moduleName]/install/js/[moduleName]/[smth]
$testPath = '/bitrix/modules/'.$moduleName.'/install/'. $testEntry;
if (mb_strpos($path, $testPath.'/') === 0 || $path == $testPath)
{
return $testEntry;
}
if ($testEntry == 'templates')
{
// /bitrix/modules/[moduleName]/install/public/templates/[templateName]
$testPath = '/bitrix/modules/'.$moduleName.'/install/public/'. $testEntry;
if (mb_strpos($path, $testPath.'/') === 0 || $path == $testPath)
{
return $testEntry;
}
}
// /bitrix/modules/[moduleName]/install/bitrix/templates/[templateName]
$testPath = '/bitrix/modules/'.$moduleName.'/install/bitrix/'. $testEntry;
if (mb_strpos($path, $testPath.'/') === 0 || $path == $testPath)
{
return $testEntry;
}
// /bitrix/modules/[moduleName]/install/public/templates/[templateName]
/*$testPath = '/bitrix/modules/'.$moduleName.'/install/public/'. $testEntry;
if (mb_strpos($path, $testPath. '/') === 0 || $path == $testPath)
{
return $testEntry;
}*/
// /bitrix/modules/[moduleName]/lang/#LANG_ID#/[smth]
$testPath = '/bitrix/modules/'.$moduleName.'/lang/#LANG_ID#/'. $testEntry;
if (mb_strpos($path, $testPath.'/') === 0 || $path == $testPath)
{
return $testEntry;
}
// /bitrix/modules/[moduleName]/lang/#LANG_ID#/install/[smth]
$testPath = '/bitrix/modules/'.$moduleName.'/lang/#LANG_ID#/install/'. $testEntry;
if (mb_strpos($path, $testPath.'/') === 0 || $path == $testPath)
{
return $testEntry;
}
// /bitrix/modules/[moduleName]/handlers/delivery/[smth]
// /bitrix/modules/[moduleName]/handlers/paysystem/[smth]
$testPath = '/bitrix/modules/'.$moduleName.'/handlers/'. $testEntry;
if (mb_strpos($path, $testPath.'/') === 0 || $path == $testPath)
{
return $testEntry;
}
// /bitrix/modules/[moduleName]/payment/[paymentHandler]
}
}
return $assignment;
}