src/Form.php
protected function initLayout()
    {
        if ($this->layout === null) {
            $this->layout = 'Generic';
        }

        if (is_string($this->layout) || is_array($this->layout)) {
            $this->layout = $this->factory($this->layout, ['form'=>$this], 'FormLayout');
            $this->layout = $this->add($this->layout);
        } elseif (is_object($this->layout)) {
            $this->layout->form = $this;
            $this->add($this->layout);
        } else {
            throw new Exception(['Unsupported specification of form layout. Can be array, string or object', 'layout' => $this->layout]);
        }

        // Add save button in layout
        if ($this->buttonSave) {
            $this->buttonSave = $this->layout->addButton($this->buttonSave);
            $this->buttonSave->setAttr('tabindex', 0);
            $this->buttonSave->on('click', $this->js()->form('submit'));
            $this->buttonSave->on('keypress', new jsExpression('if (event.keyCode === 13){$([name]).form("submit");}', ['name' => '#'.$this->name]));
        }
    }
protected function initLayout()
    {
        if ($this->layout === null) {
            $this->layout = 'Generic';
        }

        if (is_string($this->layout) || is_array($this->layout)) {
            $this->layout = $this->factory($this->layout, ['form'=>$this], 'FormLayout');
            $this->layout = $this->add($this->layout);
        } elseif (is_object($this->layout)) {
            $this->layout->form = $this;
            $this->add($this->layout);
        } else {
            throw new Exception(['Unsupported specification of form layout. Can be array, string or object', 'layout' => $this->layout]);
        }

        // Add save button in layout
        if ($this->buttonSave) {
            $this->buttonSave = $this->layout->addButton($this->buttonSave);
            $this->buttonSave->setAttr('tabindex', 0);
            $this->buttonSave->on('click', $this->js()->form('submit'));
            $this->buttonSave->on('keypress', new jsExpression('if (event.keyCode === 13){$([name]).form("submit");}', ['name' => '#'.$this->name]));
        }
    }
protected function initLayout ( ) { if ( $ this -> layout === null ) { $ this -> layout = 'Generic' ; } if ( is_string ( $ this -> layout ) || is_array ( $ this -> layout ) ) { $ this -> layout = $ this -> factory ( $ this -> layout , [ 'form' => $ this ] , 'FormLayout' ) ; $ this -> layout = $ this -> add ( $ this -> layout ) ; } elseif ( is_object ( $ this -> layout ) ) { $ this -> layout -> form = $ this ; $ this -> add ( $ this -> layout ) ; } else { throw new Exception ( [ 'Unsupported specification of form layout. Can be array, string or object' , 'layout' => $ this -> layout ] ) ; } // Add save button in layout if ( $ this -> buttonSave ) { $ this -> buttonSave = $ this -> layout -> addButton ( $ this -> buttonSave ) ; $ this -> buttonSave -> setAttr ( 'tabindex' , 0 ) ; $ this -> buttonSave -> on ( 'click' , $ this -> js ( ) -> form ( 'submit' ) ) ; $ this -> buttonSave -> on ( 'keypress' , new jsExpression ( 'if (event.keyCode === 13){$([name]).form("submit");}' , [ 'name' => '#' . $ this -> name ] ) ) ; } }
initialize form layout. You can inject custom layout
if you 'layout'=>.. to constructor.
initialize form layout . You can inject custom layout if you layout = > .. to constructor .