Update Content of the Block landing.block.updatecontent

We are still updating this page

Some data may be missing here — we will complete it shortly.

Scope: landing

Who can execute the method: any user

The method landing.block.updatecontent updates the content of an already placed block on the page to any arbitrary content. To change the content part, it is recommended to use the method landing.block.updatenodes. It will return true on success, or an error.

Warning

  • If the new block markup does not align with its current manifest, the block may become non-editable.
  • Content is passed through a sanitizer, which may remove some suspicious attributes and tags.

Parameters

Method

Description

Available since

lid
unknown

Page identifier

block
unknown

Block identifier

content
unknown

New block content

designed
unknown

Optional, defaults to false. If true is passed, the block will be considered locked from modification by the system's standard updater.

Note

The style attribute may be stripped by the built-in sanitizer. To bypass this, use the bxstyle attribute instead. When added, the system converts it to the standard style.

Examples

try
        {
        	const response = await $b24.callMethod(
        		'landing.block.updatecontent',
        		{
        			lid: 625,
        			block: 11883,
        			content: '<h3>My super content</h3>'
        		}
        	);
        	
        	const result = response.getData().result;
        	console.info(result);
        }
        catch(error)
        {
        	console.error(error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'landing.block.updatecontent',
                    [
                        'lid'     => 625,
                        'block'   => 11883,
                        'content' => '<h3>My super content</h3>',
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            // Your required data processing logic
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error updating block content: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'landing.block.updatecontent',
            {
                lid: 625,
                block: 11883,
                content: '<h3>My super content</h3>'
            },
            function(result)
            {
                if(result.error())
                {
                    console.error(result.error());
                }
                else
                {
                    console.info(result.data());
                }
            }
        );
        

How to Use Examples in Documentation