Core/Html/Controls/UiButton.php
public function build()
    {
        if ($this->mode == 'ajax') {
            $this->data['ajax'] = 'link';
        }

        // Set text and set icon means we have a button of type imagebutton
        if ($this->text && $this->icon) {
            $this->type = 'imgbutton';
        }

        // icon/image
        if ($this->type == 'icon') {
            $this->css['icon'] = 'icon';
            $this->icon->noStack();
            $this->inner = $this->icon->build();
        }

        // textbutton
        if ($this->type == 'button') {
            $this->inner = '<span class="button-text">' . $this->text . '</span>';
        }

        // simple link
        if ($this->type == 'link') {
            $this->css['link'] = 'link';
            $this->inner = '<span class="link-text">' . $this->text . '</span>';
        }

        // imgbutton
        if ($this->type == 'imgbutton') {
            $this->icon->noStack();
            $this->inner = $this->icon->build() . ' ' . $this->text;
        }

        // Do we need to set the default button css code for a non link?
        if ($this->type != 'link') {

            $this->css['btn'] = 'btn';

            $check = [
                'btn-primary',
                'btn-success',
                'btn-warning',
                'btn-info',
                'btn-default'
            ];

            if ($this->checkCss($check) == false) {
                $this->addCss('btn-default');
            }
        }

        return parent::build();
    }
public function build()
    {
        if ($this->mode == 'ajax') {
            $this->data['ajax'] = 'link';
        }

        // Set text and set icon means we have a button of type imagebutton
        if ($this->text && $this->icon) {
            $this->type = 'imgbutton';
        }

        // icon/image
        if ($this->type == 'icon') {
            $this->css['icon'] = 'icon';
            $this->icon->noStack();
            $this->inner = $this->icon->build();
        }

        // textbutton
        if ($this->type == 'button') {
            $this->inner = '<span class="button-text">' . $this->text . '</span>';
        }

        // simple link
        if ($this->type == 'link') {
            $this->css['link'] = 'link';
            $this->inner = '<span class="link-text">' . $this->text . '</span>';
        }

        // imgbutton
        if ($this->type == 'imgbutton') {
            $this->icon->noStack();
            $this->inner = $this->icon->build() . ' ' . $this->text;
        }

        // Do we need to set the default button css code for a non link?
        if ($this->type != 'link') {

            $this->css['btn'] = 'btn';

            $check = [
                'btn-primary',
                'btn-success',
                'btn-warning',
                'btn-info',
                'btn-default'
            ];

            if ($this->checkCss($check) == false) {
                $this->addCss('btn-default');
            }
        }

        return parent::build();
    }
public function build ( ) { if ( $ this -> mode == 'ajax' ) { $ this -> data [ 'ajax' ] = 'link' ; } // Set text and set icon means we have a button of type imagebutton if ( $ this -> text && $ this -> icon ) { $ this -> type = 'imgbutton' ; } // icon/image if ( $ this -> type == 'icon' ) { $ this -> css [ 'icon' ] = 'icon' ; $ this -> icon -> noStack ( ) ; $ this -> inner = $ this -> icon -> build ( ) ; } // textbutton if ( $ this -> type == 'button' ) { $ this -> inner = '<span class="button-text">' . $ this -> text . '</span>' ; } // simple link if ( $ this -> type == 'link' ) { $ this -> css [ 'link' ] = 'link' ; $ this -> inner = '<span class="link-text">' . $ this -> text . '</span>' ; } // imgbutton if ( $ this -> type == 'imgbutton' ) { $ this -> icon -> noStack ( ) ; $ this -> inner = $ this -> icon -> build ( ) . ' ' . $ this -> text ; } // Do we need to set the default button css code for a non link? if ( $ this -> type != 'link' ) { $ this -> css [ 'btn' ] = 'btn' ; $ check = [ 'btn-primary' , 'btn-success' , 'btn-warning' , 'btn-info' , 'btn-default' ] ; if ( $ this -> checkCss ( $ check ) == false ) { $ this -> addCss ( 'btn-default' ) ; } } return parent :: build ( ) ; }
Builds and returns button html code

@param string $wrapper

@throws Error

@return string
Builds and returns button html code