- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/node/styleimg.php
- Класс: BitrixLandingNodeStyleImg
- Вызов: StyleImg::getNode
static function getNode(Block $block, $selector): array
{
if (!self::isCorrectNodeType($block, $selector))
{
$data = Img::getNode($block, $selector);
}
else
{
$data = [];
$resultList = NodeStyle::getNodesBySelector($block, $selector);
foreach ($resultList as $pos => $res)
{
$data[$pos] = [
'src' => '',
'src2x' => '',
'id' => null,
'id2x' => null,
'alt' => '',
'isLazy' => 'N',
];
if ($res->getTagName() !== 'IMG')
{
$isLazy =
$res->getAttribute('data-lazy-styleimg')
&& $res->getAttribute('data-lazy-styleimg') === 'Y'
;
$nodeData =
$isLazy
? self::getNodeDataLazy($res)
: self::getNodeData($res)
;
if ($nodeData)
{
$files = File::getFilesFromBlock($block->getId());
if (!in_array($nodeData['id'], $files))
{
continue;
}
if ($nodeData['id2x'] && !in_array($nodeData['id'], $files))
{
unset($nodeData['id2x'], $nodeData['src2x'], $nodeData['lazyOrigSrc2x']);
}
$data[$pos] = $nodeData;
}
}
}
}
return $data;
}