Improve custom control output in the builder

We need a straight-forward, consistent method for modifying existing elements with custom controls. It should be pretty simple to add a checkbox or a dropdown menu to an element that adds a class to Headings, for example. But it’s not.

bricks/element/render_attributes doesn’t work in the builder for all elements; the css property for controls is too limited (and sometimes undesirable); etc.

The class picker is not client-friendly. The fact that Bricks (bizarrely, annoyingly) includes controls for things like “Lead” and “Hero” styles (side-rant: which could and should be class names added only by developers where those are applicable), demonstrates at least some level of acknowledgement that settings are sometimes preferable over the class selector. For sites where clients build pages using Bricks, it’s a must.

After reading source code and documentation, I believe it’s not doable without replacing a number of built-in elements with customized copies. And that is a big headache for maintenance.

If bricks/element/render_attributes worked for all elements in the builder, that would go a long way. To edit the output in other ways, there needs to be a version of bricks/frontend/render_element that runs in the builder, too. And then you need to document when these are applicable. The current documentation does not note when these do not work in the builder, and it’s very confusing and frustrating.

Thanks for considering.

Example of the missing backend filter in includes/builder.php:

foreach ( Elements::$elements as $element ) {
	echo $element['class']::render_builder();
}

becomes

foreach ( Elements::$elements as $element ) {
	echo apply_filters( 'bricks/builder/render_element', $element['class']::render_builder(), $element['class'] );
}

I see the same problem for us, would be nice to add some controls that adds classes to elements instead of having to add classes using the class picker for our customers.