public function addButton($label, $options = array())
    {
        $position = 'after';
        if (is_string($options)) {
            $position = $options;
        } else {
            if (isset($options['position'])) {
                $position = $options['position'];
            }
        }
        if ($position == 'after') {
            /** @type Button $button */
            $button = $this->afterField()->add('Button', $options);
            $button->set($label);
        } else {
            /** @type Button $button */
            $button = $this->beforeField()->add('Button', $options);
            $button->set($label);
        }
        $this->js('change', $button->js()->data('val', $this->js()->val()));

        return $button;
    }
public function addButton($label, $options = array())
    {
        $position = 'after';
        if (is_string($options)) {
            $position = $options;
        } else {
            if (isset($options['position'])) {
                $position = $options['position'];
            }
        }
        if ($position == 'after') {
            /** @type Button $button */
            $button = $this->afterField()->add('Button', $options);
            $button->set($label);
        } else {
            /** @type Button $button */
            $button = $this->beforeField()->add('Button', $options);
            $button->set($label);
        }
        $this->js('change', $button->js()->data('val', $this->js()->val()));

        return $button;
    }
public function addButton ( $ label , $ options = array ( ) ) { $ position = 'after' ; if ( is_string ( $ options ) ) { $ position = $ options ; } else { if ( isset ( $ options [ 'position' ] ) ) { $ position = $ options [ 'position' ] ; } } if ( $ position == 'after' ) { /** @type Button $button */ $ button = $ this -> afterField ( ) -> add ( 'Button' , $ options ) ; $ button -> set ( $ label ) ; } else { /** @type Button $button */ $ button = $ this -> beforeField ( ) -> add ( 'Button' , $ options ) ; $ button -> set ( $ label ) ; } $ this -> js ( 'change' , $ button -> js ( ) -> data ( 'val' , $ this -> js ( ) -> val ( ) ) ) ; return $ button ; }
Position can be either 'before' or 'after'
Position can be either before or after