krakjoe / ui

Cross platform UI development in PHP
Other
519 stars 39 forks source link

[idea] UI\Controls\Form::getChild(string $label) #17

Open remicollet opened 7 years ago

remicollet commented 7 years ago

For now, I'm using something like:

class ExtenfionForm extends Form {
    private $childIndex;
    private $childControl;

    public function addChild(string $name, string $label, UI\Control $control, boolean $stretchy=NULL) {

        $this->childIndex[$name] = $this->append($label, $control, $stretchy ?? false);
        $this->childControl[$name] = $control;
    }

    public function getChild(string $name) {

        return ($this->childControl[$name] ?? NULL);
    }
}

Perhaps we need something simpler.

krakjoe commented 7 years ago

This is possible without any additional upstream change, we could do this.