• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/update/block.php
  • Класс: BitrixLandingUpdateBlock
  • Вызов: Block::updateVideoToLazyload
static function updateVideoToLazyload($nodes)
{
	foreach($nodes as $key => $node)
	{
		if($node['src'])
		{
			// youtube
			if (strpos($node['src'], 'www.youtube.com') !== false)
			{
				if ($node['source'])
				{
					$pattern = "#(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)#";
					if(preg_match($pattern, $node['source'], $matches))
					{
						$nodes[$key]['preview'] = "//img.youtube.com/vi/{$matches[4]}/sddefault.jpg";
					}
				}
			}
		}
	}

	return $nodes;
}