setAnchor
Attention! We strongly recommend first to learn more about Sites module REST documentation to understand how the module functions (with REST available in Bitrix24 Self-hosted editions). View this documentation as useful source when working with Bitrix24 Self-hosted editions and find out more details about API and only REST is not enough.
public function setAnchor( $anchor )
Sets anchor block. Please note, the block must be saved after executing a block.
Parameters
Parameter | Description | Version |
---|---|---|
anchor | Block anchor. Anchor must start with symbol from a-z and contain only symbols from a-z , 0-9 , -, _, . и : |
Example
if (\Bitrix\Main\Loader::includeModule('landing')) { \Bitrix\Landing\Landing::setEditMode(true); $landing = \Bitrix\Landing\Landing::createInstance( 1 ); if ($landing->exist()) { foreach ($landing->getBlocks() as $block) { if ($block->getId() == 46465) { $block->setAnchor('about'); $block->save(); $landing->getError()->copyError( $block->getError() ); } } } foreach ($landing->getError()->getErrors() as $error) { echo $error->getCode() . ': '; echo $error->getMessage(); echo "\n"; } }
© «Bitrix24», 2001-2024