StyleImg::getNodeDataLazy

  1. Bitrix24 API (v. 23.675.0)
  2. landing
  3. StyleImg
  4. getNodeDataLazy
  • Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/node/styleimg.php
  • Класс: BitrixLandingNodeStyleImg
  • Вызов: StyleImg::getNodeDataLazy
static function getNodeDataLazy(DOMNode $node): ?array
{
	$data = null;

	$styles = $node->getAttribute('data-style');
	if ($styles)
	{
		$stylesConverted = [];
		foreach (explode(';', $styles) as $style)
		{
			// can has mode then one ':', can't use explode!
			$separator = strpos( $style, ':');
			$key = substr($style, 0, $separator);
			$val = substr($style, $separator + 1);
			$stylesConverted[$key] = trim($val);
		}

		$fileId = (int)$node->getAttribute('data-fileid');
		if ($fileId)
		{
			$data = ['isLazy' => 'Y'];

			$data['id'] = $fileId;
			$data['lazyOrigSrc'] = self::getSrcFromStyles($stylesConverted, '1x');

			$fileId2x = (int)$node->getAttribute('data-fileid2x');
			if ($fileId2x)
			{
				$data['id2x'] = $fileId2x;
				$data['lazyOrigSrc2x'] = self::getSrcFromStyles($stylesConverted, '2x');
			}
		}
	}

	return $data;
}

Добавить комментарий