landing.block.updateattrs
landing.block.updateattrs(lid, block,data)
This method updates attributes of block nodes. Returns true or an error.
Parameters
Method | Description | Available from version |
---|---|---|
lid | Landing page ID | |
block | Block ID | |
data | Array of selector and new data-attributes values. For example, data: {'.bitrix24forms': {'data-b24form': 'tratrata'}} . The manifest must contain attributes, which you want to update. |
When an the attribute belongs to a card (i. e. it can have different content in various cards; selector must be passed with separator @:
data: { '.container-fluid@1': {//second card attribute will be affected (starting from zero) 'data-test-checkbox': [1, 2, 3] } }
Type of modifiable content
Each type of attribute has a specific format for saving. Provided examples show default values for each type. The format is the same when passing a new value. For example, saving into the image type attribute:
data: { '.container-fluid': { 'data-test-image': {src: 'https://i.img.com/images/i/291626458734-0-1/s-l1000.jpg', alt: 666} } }
Separate clarifications for checkbox and multiselect types: to save new value, send values of the highlighted elements:
data: { '.container-fluid': { 'data-test-checkbox': [1, 2, 3] } }
Editing parameters of dynamic blocks is performed via the method [link=6543711]landing.block.updatenodes[/link].
Example
BX24.callMethod( 'landing.block.updateattrs', { lid: 313, block: 6134, data: { '.bitrix24forms': { 'data-b24form': 'tratrata' } } }, function(result) { if(result.error()) { console.error(result.error()); } else { console.info(result.data()); } } );
© «Bitrix24», 2001-2024