• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/assets/preprocessing/icon.php
  • Класс: BitrixLandingAssetsPreProcessingIcon
  • Вызов: Icon::getIconsContentByVendor
static function getIconsContentByVendor(string $vendorName): array
{
	static $vendorContent = [];

	if (!array_key_exists($vendorName, $vendorContent))
	{
		$vendorContent[$vendorName] = [];
		$path = self::getIconsPath($vendorName);
		if ($path)
		{
			$cssFileName = $path . '/' . self::CONTENT_ICON_FILE_NAME;
			if (File::isFileExists($cssFileName))
			{
				$cssContent = File::getFileContents($cssFileName);
				if ($cssContent)
				{
					$classPrefix = $vendorName;
					$iconVendorsConfig = Config::get('icon_vendors_config');
					if ($iconVendorsConfig && isset ($iconVendorsConfig[$vendorName]['class_prefix']))
					{
						$classPrefix = $iconVendorsConfig[$vendorName]['class_prefix'];
					}
					$found = preg_match_all(
						'/.(' . $classPrefix . '-[^:]+):{1,2}befores*{s*content:s*["']((?:\\.|[^\\])*?)["'];s*}/',
						$cssContent,
						$matches
					);
					if ($found)
					{
						foreach ($matches[1] as $i => $match)
						{
							$vendorContent[$vendorName][$match] = $matches[2][$i];
						}
					}
				}
			}
		}
	}

	return $vendorContent[$vendorName];
}