/** * @param \fewbricks\bricks\brick $brick * @return $this */ public function add_brick($brick) { $brick->set_is_sub_field(true); $brick_settings = $brick->get_settings($this); foreach ($brick_settings['fields'] as $brick_field) { $this->settings['sub_fields'][] = $brick_field; } return $this; }
/** * 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')); } }
/** * @param repeater|flexible_content|\fewbricks\bricks\brick $object_to_prepare_for * @param $setting */ private function prepare_label_addition($object_to_prepare_for, $setting) { if ('' !== ($field_label_addition = $object_to_prepare_for->get_setting('field_label_' . $setting, ''))) { if ($setting == 'prefix') { $new_label = $field_label_addition . ' - ' . $this->get_setting('label'); } else { $new_label = $this->get_setting('label') . ' - ' . $field_label_addition; } $this->set_setting('label', $new_label); } }
/** * @param \fewbricks\acf\fields\repeater|\fewbricks\acf\fields\flexible_content|\fewbricks\bricks\brick $object_to_prepare_for * @param $setting */ private function prepare_label_addition($object_to_prepare_for, $setting) { if ('' !== ($field_label_extra = $object_to_prepare_for->get_setting('field_label_' . $setting, ''))) { // If the break we are dealing with has a prefix, we need to respect that. if ('' !== ($my_field_label_extra = $this->get_setting('field_label_' . $setting, ''))) { $field_label_extra .= ' - ' . $my_field_label_extra; } $this->set_setting('field_label_' . $setting, $field_label_extra); } }
/** * @param brick $brick_to_add */ protected function add_brick($brick_to_add) { $this->add_fields($brick_to_add->get_settings($this)['fields']); }
/** * @param \fewbricks\bricks\brick $brick * @return $this */ public function add_brick($brick) { // Add the fields of the brick to the fields of the brick $this->set_setting('fields', array_merge($this->get_setting('fields'), $brick->get_settings($this)['fields'])); return $this; }