Browser: Any
OS: Windows
In regards to:
Builder: Add custom HTML attributes to the canvas (from Bricks filters & element settings)
I added some a custom checkbox-control via the bricks/elements/section/controls
filter to the section element and it adds some class on the frontend via the bricks/element/render_attributes
filter, but it’s not working on the canvas.
what am I doing wrong?
This is my code:
add_filter('bricks/elements/section/controls', function ($controls) {
$controls['testPaddingTop'] = [
'tab' => 'content',
'type' => 'checkbox',
'label' => esc_html__('Padding Top', 'bricks'),
];
return $controls;
});
add_filter('bricks/element/render_attributes', function ($attributes, $key, $element) {
if (
isset($element->settings['testPaddingTop'])
&& $element->settings['testPaddingTop'] == true
) {
$attributes[$key]['class'][] = 'brxe-section--p-top';
}
return $attributes;
}, 10, 3);
And my styles:
.brxe-section--p-top{
background:red;
padding-top:300px;
}