Core/Html/FormDesigner/FormGroup.php
public function &addControl($control, $name='', $label = '', $value = '', $description = '', $unbound = false)
    {
        $string = new CamelCase($control);

        $control = $this->factory->create('FormDesigner\Controls\\' . $string->camelize() . 'Control');

        // Set name
        $control->setName($name);

        // set contols name
        if ($unbound && method_exists($control, 'setUnbound')) {
            $control->setUnbound();
            $control->removename();
        }

        // Label set?
        if (! empty($label) && method_exists($control, 'setLabel')) {
            $control->setLabel($label);
        }

        if (! empty($value) && method_exists($control, 'setValue')) {
            $control->setValue($value);
        }

        if (! empty($description) && method_exists($control, 'setDescription')) {
            $control->setDescription($description);
        }

        if ($control instanceof Button) {
            $control->noLabel();
        }

        // Create element
        $this->elementFactory('control', $control);

        return $control;
    }
public function &addControl($control, $name='', $label = '', $value = '', $description = '', $unbound = false)
    {
        $string = new CamelCase($control);

        $control = $this->factory->create('FormDesigner\Controls\\' . $string->camelize() . 'Control');

        // Set name
        $control->setName($name);

        // set contols name
        if ($unbound && method_exists($control, 'setUnbound')) {
            $control->setUnbound();
            $control->removename();
        }

        // Label set?
        if (! empty($label) && method_exists($control, 'setLabel')) {
            $control->setLabel($label);
        }

        if (! empty($value) && method_exists($control, 'setValue')) {
            $control->setValue($value);
        }

        if (! empty($description) && method_exists($control, 'setDescription')) {
            $control->setDescription($description);
        }

        if ($control instanceof Button) {
            $control->noLabel();
        }

        // Create element
        $this->elementFactory('control', $control);

        return $control;
    }
public function & addControl ( $ control , $ name = '' , $ label = '' , $ value = '' , $ description = '' , $ unbound = false ) { $ string = new CamelCase ( $ control ) ; $ control = $ this -> factory -> create ( 'FormDesigner\Controls\\' . $ string -> camelize ( ) . 'Control' ) ; // Set name $ control -> setName ( $ name ) ; // set contols name if ( $ unbound && method_exists ( $ control , 'setUnbound' ) ) { $ control -> setUnbound ( ) ; $ control -> removename ( ) ; } // Label set? if ( ! empty ( $ label ) && method_exists ( $ control , 'setLabel' ) ) { $ control -> setLabel ( $ label ) ; } if ( ! empty ( $ value ) && method_exists ( $ control , 'setValue' ) ) { $ control -> setValue ( $ value ) ; } if ( ! empty ( $ description ) && method_exists ( $ control , 'setDescription' ) ) { $ control -> setDescription ( $ description ) ; } if ( $ control instanceof Button ) { $ control -> noLabel ( ) ; } // Create element $ this -> elementFactory ( 'control' , $ control ) ; return $ control ; }
Creates a formcontrol and adds it by it's name to the controls list.

@param string $type
The type of control to create
@param string $name
Name of the control. Ths name is used to bind the control to a model field.

@return \Core\Html\Form\AbstractForm
Creates a formcontrol and adds it by it s name to the controls list .