src/PeekAndPoke/Component/Formal/Form.php
public function addFormField(IFormField $field, $isExtra = false)
    {
        $fieldId = $field->getId();

        if (empty($fieldId)) {
            throw new \LogicException('The access path of a form field must not be empty');
        }

        // setup the field and remember it
        $field->setParent($this);
        $this->children[$fieldId] = $field;

        // non-extra fields are tracked and automatically mapped from and to the subject
        if ($isExtra === false) {
            // setup the mapping context, remember it
            $mappingContext                  = new MappingContext($this, $field, $this->accessorChain);
            $this->mappingContexts[$fieldId] = $mappingContext;
        }

        return $field;
    }
public function addFormField(IFormField $field, $isExtra = false)
    {
        $fieldId = $field->getId();

        if (empty($fieldId)) {
            throw new \LogicException('The access path of a form field must not be empty');
        }

        // setup the field and remember it
        $field->setParent($this);
        $this->children[$fieldId] = $field;

        // non-extra fields are tracked and automatically mapped from and to the subject
        if ($isExtra === false) {
            // setup the mapping context, remember it
            $mappingContext                  = new MappingContext($this, $field, $this->accessorChain);
            $this->mappingContexts[$fieldId] = $mappingContext;
        }

        return $field;
    }
Add a field to the form

@param IFormField $field   The field to add
@param bool       $isExtra Non-extra fields are tracked and automatically mapped from and to the subject.

@return IFormField