How to hide some Control Options?

Hi everyone,

I’m starting in Bricks and realize I don’t need all of the control options for the different elements.

I found this page which explains that options can be removed via bricks/setup/control_options: https://academy.bricksbuilder.io/article/filter-bricks-setup-control_options/

In the Controls (Developer) topic, there also are explanations on filtering out unwanted options with the exclude parameter, here for example: https://academy.bricksbuilder.io/article/background-control/

The thing is, I have no idea how to implement these lines of code. I tried adding them to the child theme’s functions.php which didn’t work. In which file/area should they be added? Does a php code exist with the full list of control options, with an easy way to show/hide them in the builder? I would love some help.

I am hiding some control options with Custom Builder mode CSS, which works for most but not all control options are in a [data-controlkey=" "] format. For some I have only found some nth-child() paths for CSS, which inevitably hide other controls too.

Thanks for your time!
Jimmy

So what you are trying to do is only partialy posible at the moment with the first mentioned filter.

You can globally unset or set new control options like this with the bricks/setup/control_options filter:

add_filter('bricks/setup/control_options', function ($control_options) {

  // Before unsetting a control option
  Bricks\Helpers::pre_dump($control_options);

  unset($control_options['backgroundPosition']['top left']);
  $control_options['backgroundPosition']['top left'] = 'This is TOP LEFT';
  // After unsetting a control option & adding a new one
  Bricks\Helpers::pre_dump($control_options);

  return $control_options;
});

On the other hand, the Controls (Developer) are not filters to modify global controls, but rather it is the tools to create your own custom elements. If you want to learn more about that, you can find a guide here:

On the roadmap you can see, that bricks is planing to implement a more granular controls restriction. Maybe what you want is possible then.

Cheers Suat