- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/block.php
- Класс: BitrixLandingBlock
- Вызов: Block::setAnchor
public function setAnchor($anchor)
{
if (!is_string($anchor))
{
return false;
}
$anchor = trim($anchor);
$check = !$anchor || preg_match_all('/^[a-z]{1}[a-z0-9-_.:]+$/i', $anchor);
if (!$check)
{
$this->error->addError(
'BAD_ANCHOR',
Loc::getMessage('LANDING_BLOCK_BAD_ANCHOR')
);
return false;
}
if (History::isActive())
{
$history = new History($this->getLandingId(), History::ENTITY_TYPE_LANDING);
$history->push('CHANGE_ANCHOR', [
'block' => $this,
'valueBefore' => $this->anchor,
'valueAfter' => $anchor,
]);
}
$this->anchor = $anchor;
return true;
}