• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/publicaction/block.php
  • Класс: BitrixLandingPublicActionBlock
  • Вызов: Block::changeAnchor
static function changeAnchor($lid, $block, $data, bool $preventHistory = false)
{
	$error = new BitrixLandingError;
	$result = new PublicActionResult();

	Landing::setEditMode();

	$preventHistory ? History::deactivate() : History::activate();

	$landing = Landing::createInstance($lid, [
		'blocks_id' => $block
	]);

	if ($landing->exist())
	{
		$block = intval($block);
		$blocks = $landing->getBlocks();
		if (isset($blocks[$block]))
		{
			$blocks[$block]->setAnchor($data);
			$result->setResult($blocks[$block]->save());
			$result->setError($blocks[$block]->getError());
			if ($blocks[$block]->getError()->isEmpty())
			{
				$landing->touch();
			}
		}
		else
		{
			$error->addError(
				'BLOCK_NOT_FOUND',
				Loc::getMessage('LANDING_BLOCK_NOT_FOUND')
			);
		}
	}
	$result->setError($landing->getError());

	return $result;
}