Filter: builder/settings/{type}/controls_data
This filter allows you to add new controls to the Page Settings or Template Settings panels in the builder.
To manage the Template Settings controls use the builder/settings/template/controls_data hook like so:
add_filter( 'builder/settings/template/controls_data', function( $data ) { // Do something
return $data;} );To manage the Page Settings controls use the builder/settings/page/controls_data hook like so:
add_filter( 'builder/settings/page/controls_data', function( $data ) { // Do something
return $data;} );Example: Add a control to select the user roles in the author archive template type template condition
add_filter( 'builder/settings/template/controls_data', function( $data ) { // Get all the site user roles $all_roles = wp_roles()->roles;
$roles = [];
foreach ( $all_roles as $role => $role_data ) { $roles[ $role ] = $role_data['name']; }
// Add control to select the user roles for an author archive template type $data['controls']['templateConditions']['fields']['archiveAuthorRoles'] = [ 'type' => 'select', 'label' => esc_html__( 'Author roles', 'bricks' ), 'options' => $roles, 'multiple' => true, 'placeholder' => esc_html__( 'Select role', 'bricks' ), 'description' => esc_html__( 'Leave empty to apply template to all roles.', 'bricks' ), 'required' => [ 'archiveType', '=', 'author' ], ];
return $data;} );Was this helpful?
A quick vote and short notes help us improve these docs faster.
Leave a note for us
Please do not include passwords, license keys, or personal data. We store submitted notes to improve the docs.
Thanks for sharing feedback. We're using it to improve these docs.