src/Form/Container.php
public function setForm($key, $spec, $enabled = true)
    {
        if (is_object($spec)) {
            if ($spec instanceof FormParentInterface) {
                $spec->setParent($this);
            }

            $spec = [ '__instance__' => $spec, 'name' => $key, 'entity' => '*' ];
        }

        if (!is_array($spec)) {
            $spec = array('type' => $spec, 'name' => $key);
        }
        if (!isset($spec['name'])) {
            $spec['name'] = $key;
        }
        if (!isset($spec['entity'])) {
            $spec['entity'] = '*';
        }
        
        $this->forms[$key] = $spec;

        if ($enabled) {
            $this->enableForm($key);
        } elseif (true === $this->activeForms) {
            $this->activeForms = false;
        }
        return $this;
    }
public function setForm($key, $spec, $enabled = true)
    {
        if (is_object($spec)) {
            if ($spec instanceof FormParentInterface) {
                $spec->setParent($this);
            }

            $spec = [ '__instance__' => $spec, 'name' => $key, 'entity' => '*' ];
        }

        if (!is_array($spec)) {
            $spec = array('type' => $spec, 'name' => $key);
        }
        if (!isset($spec['name'])) {
            $spec['name'] = $key;
        }
        if (!isset($spec['entity'])) {
            $spec['entity'] = '*';
        }
        
        $this->forms[$key] = $spec;

        if ($enabled) {
            $this->enableForm($key);
        } elseif (true === $this->activeForms) {
            $this->activeForms = false;
        }
        return $this;
    }
Sets a form or form specification.

if <b>$spec</b> is a string, it is used as form type, name is set to <b>$key</b>

@param string       $key
@param string|array $spec
@param boolean      $enabled Should the formular be enabled or not

@return self