/**
* Dont add more than one brick to a layout
* @param \fewbricks\bricks\brick $brick
* @return $this
*/
public function add_brick($brick)
{
$brick->set_is_layout(true);
$brick_fields = $brick->get_settings($this)['fields'];
foreach ($brick_fields as $brick_field) {
$this->settings['sub_fields'][] = $brick_field;
}
// Set name and label of layout to that of the brick
$this->set_setting('name', $brick->get_setting('name'));
if ($this->get_setting('label') === '') {
$this->set_setting('label', $brick->get_setting('label'));
}
}