• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/assets/manager.php
  • Класс: BitrixLandingAssetsManager
  • Вызов: Manager::processAsset
protected function processAsset(array $asset, int $location): void
{
	foreach (Types::getAssetTypes() as $type)
	{
		if (!isset($asset[$type]) || empty($asset[$type]))
		{
			continue;
		}

		if (!is_array($asset[$type]))
		{
			$asset[$type] = [$asset[$type]];
		}

		switch ($type)
		{
			case Types::KEY_RELATIVE:
			{
				foreach ($asset[$type] as $rel)
				{
					$this->addAsset($rel, $location);
				}
				break;
			}

			case Types::TYPE_JS:
			case Types::TYPE_CSS:
			case Types::TYPE_LANG:
			{
				foreach ($asset[$type] as $path)
				{
					if (CMain::isExternalLink($path))
					{
						$this->resources->addString($this->createStringFromPath($path, $type));
					}
					// todo: check is file exist
					else if (self::detectType($path))
					{
						$this->resources->add($path, $type, $location);
					}
				}
				break;
			}

			case Types::TYPE_FONT:
			{
				// preload fonts add immediately
				foreach ($asset[$type] as $fontFile)
				{
					if (
						!CMain::isExternalLink($fontFile)
						&& File::isFileExists(LandingManager::getDocRoot() . $fontFile)
					)
					{
						$this->resources->addString($this->createStringFromPath($fontFile, $type));
					}
				}
				break;
			}

			default:
				break;
		}
	}
}