- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/node/icon.php
- Класс: BitrixLandingNodeIcon
- Вызов: Icon::saveNode
static function saveNode(BitrixLandingBlock $block, $selector, array $data)
{
$doc = $block->getDom();
$resultList = $doc->querySelectorAll($selector);
$valueBefore = static::getNode($block, $selector);
foreach ($data as $pos => $value)
{
$classList = (isset($value['classList']) && is_array($value['classList']))
? $value['classList']
: (array)$value;
$className = implode(' ', $classList);
if (isset($value['url']))
{
$url = is_array($value['url'])
? json_encode($value['url'])
: $value['url'];
}
else
{
$url = '';
}
if ($classList)
{
if (isset($resultList[$pos]))
{
$resultList[$pos]->setAttribute('class', $className);
if ($url)
{
$resultList[$pos]->setAttribute('data-pseudo-url', $url);
}
if (History::isActive())
{
$history = new History($block->getLandingId(), History::ENTITY_TYPE_LANDING);
$history->push('EDIT_ICON', [
'block' => $block,
'selector' => $selector,
'position' => (int)$pos,
'valueBefore' => $valueBefore[$pos],
'valueAfter' => $value,
]);
}
}
}
}
}