• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entitybankdetail.php
  • Класс: Bitrix\Crm\EntityBankDetail
  • Вызов: EntityBankDetail::loadPhrases
protected function loadPhrases(int $countryId): array
{
	$phrases = [];

	if (static::checkCountryId($countryId))
	{
		$countryCode = EntityPreset::getCountryCodeById($countryId);
		$countryCodeLower = mb_strtolower($countryCode);
		$phrasesConfig = [];
		$filePath= Main\IO\Path::normalize(
			Main\Application::getDocumentRoot().
			"/bitrix/modules/crm/lib/requisite/phrases/bankdetail_$countryCodeLower.php"
		);
		if (file_exists($filePath))
		{
			include($filePath);
		}
		if (isset($phrasesConfig['encoding'])
			&& is_string($phrasesConfig['encoding'])
			&& $phrasesConfig['encoding'] !== ''
			&& is_array($phrasesConfig['phrases'])
			&& !empty($phrasesConfig['phrases']))
		{
			$phrases = $phrasesConfig['phrases'];
			$sourceEncoding = mb_strtolower($phrasesConfig['encoding']);
			$targetEncoding = Translation::getCurrentEncoding();
			$needConvertEncoding = ($sourceEncoding !== $targetEncoding);
			foreach ($phrases as $phraseId => $phrase)
			{
				if (is_string($phrase))
				{
					if ($needConvertEncoding && $phrase !== '')
					{
						$convertedValue = Encoding::convertEncoding(
							$phrase,
							$sourceEncoding,
							$targetEncoding
						);
						$phrases[$phraseId] =
							is_string($convertedValue) ? $convertedValue : $phraseId;
					}
				}
				else
				{
					$phrases[$phraseId] = null;
				}
			}
		}
	}

	return $phrases;
}