PHP Filters
lzb/prepare_block_attribute
Filters attribute data for each control, that used when registering blocks.
Attributes
Name | Type | Description |
---|---|---|
$attribute_data | Array | attribute data |
$control | Array | control data |
$controls | Array | all available controls |
$k | String | current control ID in an array of controls |
$block | Array | block data |
Usage
PHP
function my_lzb_prepare_block_attribute( $attribute_data, $control, $controls, $k, $block ) {
// Change default value for custom control "my-control"
if ( $control && isset( $control['type'] ) && 'my-control' === $control['type'] ) {
$attribute_data['default'] = 'my custom default value';
return $attribute_data;
}
return $attribute_data;
}
add_filter( 'lzb/prepare_block_attribute', 'my_lzb_prepare_block_attribute', 10, 5 );