ok found the issue and solution
this works well
add_action( 'init', function () {
$targets = [ 'section', 'container', 'block', 'div' ];
foreach ( $targets as $name ) {
add_filter( "bricks/elements/{$name}/controls", function ( $controls ) {
$controls['custom_text'] = [
'tab' => 'content',
'label' => esc_html__( 'Custom Text', 'snn' ),
'type' => 'text',
'default' => '',
];
return $controls;
} );
}
} );
add_filter( 'bricks/frontend/render_element', function ( $html, $element ) {
$targets = [ 'section', 'container', 'block', 'div' ];
$custom = $element->settings['custom_text'] ?? '';
if ( $custom !== '' && in_array( $element->name, $targets, true ) ) {
$html .= '<div class="brx-custom-text">' . esc_html( $custom ) . '</div>';
}
return $html;
}, 10, 2 );