Carbon_Fields\Widget\Widget::add_fields PHP Method

add_fields() public method

Append array of fields to the current fields set. All items of the array must be instances of Field and their names should be unique for all Carbon containers.
public add_fields ( array $fields )
$fields array
    public function add_fields($fields)
    {
        foreach ($fields as $field) {
            if (!is_a($field, 'Carbon_Fields\\Field\\Field')) {
                Incorrect_Syntax_Exception::raise('Object must be of type Carbon_Fields\\Field\\Field');
            }
            $this->verify_unique_field_name($field->get_name());
            $field->set_prefix('');
            if (!$field->get_datastore()) {
                $field->set_datastore($this);
            }
            if (is_a($field, 'Carbon_Fields\\Field\\Complex_Field')) {
                $this->complex_field_names[] = $field->get_name();
            }
        }
        $this->custom_fields = array_merge($this->custom_fields, $fields);
    }