Add a FormField to the form's fields.

@param FormField $field
@return $this
552886
public function addField(Element $field)
    {
        if ($field->getType() == 'radio') {
            $this->fields[$field->getId()] = $field;
            $field->group($field->getName());
        } else {
            $this->fields[$field->getName()] = $field;
        }
        return $this;
    }
404197
public function addField(FieldInterface $field)
    {
        $this->fields[] = $field;
        $field->setContentType($this);

        return $this;
    }
802487
public function removeField(FormField $field)
    {
        if ($this->fields->contains($field) === true) {
            $field->setForm(null);
            $this->fields->removeElement($field);
        }

        return $this;
    }
1045213
public function add(FormField $field) {
		if($this->owner->hasTabSet()) {
			$before = ($this->tab == "Main" && $this->owner->dataFieldByName("Content")) ? "Content" : null;
			$this->owner->addFieldToTab("Root.{$this->tab}",$field, $before);
		}
		else {
			$this->owner->push($field);
		}
	}
56493
protected function updateFormField($field)
    {
        // set the error / formatting messages
        $field->setCustomValidationMessage($this->getErrorMessage()->RAW());

        // set the right title on this field
        if ($this->RightTitle) {
            $field->setRightTitle($this->RightTitle);
        }

        // if this field is required add some
        if ($this->Required) {
            // Required validation can conflict so add the Required validation messages as input attributes
            $errorMessage = $this->getErrorMessage()->HTML();
            $field->addExtraClass('requiredField');
            $field->setAttribute('data-rule-required', 'true');
            $field->setAttribute('data-msg-required', $errorMessage);

            if ($identifier = UserDefinedForm::config()->required_identifier) {
                $title = $field->Title() . " <span class='required-identifier'>". $identifier . "</span>";
                $field->setTitle(DBField::create_field('HTMLText', $title));
            }
        }

        // if this field has an extra class
        if ($this->ExtraClass) {
            $field->addExtraClass($this->ExtraClass);
        }

        // if ShowOnLoad is false hide the field
        if (!$this->ShowOnLoad) {
            $field->addExtraClass($this->ShowOnLoadNice());
        }

        // if this field has a placeholder
        if (strlen($this->Placeholder) >= 0) {
            $field->setAttribute('placeholder', $this->Placeholder);
        }
    }
999617
public function add(FieldTypeInterface $field): FormBuilderInterface
    {
        /** @var BaseType $field */
        $opts = $this->validateOptions(array_merge([
            'errors' => $this->form->getOption('errors'),
            'theme' => $this->form->getOption('theme')
        ], $field->getOptions()), $field);
        $field->setLocale($this->form->getLocale());
        $field->setOptions($opts);
        $field->setForm($this->form);
        $field->setViewFactory($this->form->getViewer());
        $field->setResourceTransformerFactory($this->form->getResourceTransformerFactory());

        // DTO
        if (! is_null($this->dataClass) && is_object($this->dataClass) && $field->getOption('mapped')) {
            $this->dataMapperManager->mapFromObjectToField($this->dataClass, $field);
        }

        // Check if section instance already exists on the form.
        // If not, create a new section instance.
        if ($this->form->repository()->hasGroup($field->getOption('group'))) {
            // The section/group instance is already registered, just fetch it.
            $section = $this->form->repository()->getGroup($field->getOption('group'));
        } else {
            // No defined group. Let's create an instance so we can attach
            // the field to it right after.
            $section = new Section($field->getOption('group'));
        }

        // Setup group/section default view.
        $section->setTheme($this->form->getTheme());
        $section->setView('form.group');

        // Add the field first to section instance.
        // Then pass both objects to the repository.
        $section->addItem($field);
        $this->form->repository()->addField($field, $section);

        return $this;
    }
13156
public function registerMany($formFields)
    {
        foreach ($formFields as $fieldName => $fieldClass) {
            $this->register($fieldName, $fieldClass);
        }
    }
822136
public function addFieldFromConfig($name, $field)
    {
        $this->addField(Fields::create($name, $field));
        return $this;
    }
133989
public function addField($field)
    {
        $entityFieldNames = array_flip($this->mappedFields);
        if (array_key_exists($field, $entityFieldNames)) {
            parent::addField($entityFieldNames[$field]);
        }

        return $this;
    }
1036416
public function setFieldType($field, Type $type) {
    $this->types->set($this->getKey($field), $type);
    return $this;
  }
515396
public function append($field, $value)
    {
        $this->resolver->resolveForTyping($field)->sendKeys($value);

        return $this;
    }
1201110
public function addField(Field $field)
    {
        $field
            ->setSection($this->currentSection)
            ->setOptionName($this->registry['option_name'])
        ;

        if (isset($this->registry['field_values'][$field->getId()])) {
            $field->setValue($this->registry['field_values'][$field->getId()]);
        }

        $this->registry['fields'][] = $field;

        return $this;
    }
1012310
public function field(string $field) : self
    {
        $this->currentField = $field;
        $this->expr->field($field);

        return $this;
    }
1028741
public function createCustomField(Field $field)
		{
			$form_data = array(
				'fieldname' => $field->getName(),
				'fieldtype' => $field->getType(),
				'description' => $field->getDescription()
			);
			$this->call('customfieldcreate', $form_data);

			return TRUE;
		}
1318081
public function addFields(array $fields)
    {
        $oldFields = $this->_queryBuilder->getFields() ? $this->_queryBuilder->getFields() : array();
        $newFields = array_merge($oldFields, $fields);
        $this->setFields($newFields);
        return $this;
    }
1004828
public function push(Field $field){

        $this->offsetSet($field->getName(), $field);

        $numArgs = func_num_args();

        if($numArgs > 1){
            $args = func_get_args();
            for($i=1;$i<$numArgs;$i++){
                $this->push($args[$i]);
            }
        }
        return $this;
    }
1352357
public function add($name, $field = null, $fieldset = null, $group = null)
    {
        return $this->form->add($name, $field, $fieldset, $group);
    }