public function renderButton($label = '', array $options = [], array $attributes = [])
    {
        $options = $this->getButtonOptionsResolver()->resolve($options);

        $tag = 'button';
        $classes = ['btn', 'btn-'.$options['theme'], 'btn-'.$options['size']];
        $defaultAttributes = [
        	'class' => sprintf('btn btn-%s btn-%s', $options['theme'], $options['size']),
        ];
        if ($options['type'] == 'link') {
            if (0 == strlen($options['path'])) {
                throw new \InvalidArgumentException('"path" option must be defined for "link" button type.');
            }
            $tag = 'a';
            $defaultAttributes['href'] = $options['path'];
        } else {
            $defaultAttributes['type'] = $options['type'];
        }

        if (array_key_exists('class', $attributes)) {
            $classes = array_merge($classes, explode(' ', $attributes['class']));
            unset($attributes['class']);
        }
        $defaultAttributes['class'] = implode(' ', $classes);
        $attributes = array_merge($defaultAttributes, $attributes);

        $icon = '';
        if(0 < strlen($options['icon'])) {
            $icon = $options['fa_icon'] ? 'fa fa-'.$options['icon'] : 'glyphicon glyphicon-'.$options['icon'];
        }

        return $this->controlsTemplate->renderBlock('button', [
            'tag'   => $tag,
            'attr'  => $attributes,
            'label' => $label,
            'icon'  => $icon,
        ]);
    }
public function renderButton($label = '', array $options = [], array $attributes = [])
    {
        $options = $this->getButtonOptionsResolver()->resolve($options);

        $tag = 'button';
        $classes = ['btn', 'btn-'.$options['theme'], 'btn-'.$options['size']];
        $defaultAttributes = [
        	'class' => sprintf('btn btn-%s btn-%s', $options['theme'], $options['size']),
        ];
        if ($options['type'] == 'link') {
            if (0 == strlen($options['path'])) {
                throw new \InvalidArgumentException('"path" option must be defined for "link" button type.');
            }
            $tag = 'a';
            $defaultAttributes['href'] = $options['path'];
        } else {
            $defaultAttributes['type'] = $options['type'];
        }

        if (array_key_exists('class', $attributes)) {
            $classes = array_merge($classes, explode(' ', $attributes['class']));
            unset($attributes['class']);
        }
        $defaultAttributes['class'] = implode(' ', $classes);
        $attributes = array_merge($defaultAttributes, $attributes);

        $icon = '';
        if(0 < strlen($options['icon'])) {
            $icon = $options['fa_icon'] ? 'fa fa-'.$options['icon'] : 'glyphicon glyphicon-'.$options['icon'];
        }

        return $this->controlsTemplate->renderBlock('button', [
            'tag'   => $tag,
            'attr'  => $attributes,
            'label' => $label,
            'icon'  => $icon,
        ]);
    }
public function renderButton ( $ label = '' , array $ options = [ ] , array $ attributes = [ ] ) { $ options = $ this -> getButtonOptionsResolver ( ) -> resolve ( $ options ) ; $ tag = 'button' ; $ classes = [ 'btn' , 'btn-' . $ options [ 'theme' ] , 'btn-' . $ options [ 'size' ] ] ; $ defaultAttributes = [ 'class' => sprintf ( 'btn btn-%s btn-%s' , $ options [ 'theme' ] , $ options [ 'size' ] ) , ] ; if ( $ options [ 'type' ] == 'link' ) { if ( 0 == strlen ( $ options [ 'path' ] ) ) { throw new \ InvalidArgumentException ( '"path" option must be defined for "link" button type.' ) ; } $ tag = 'a' ; $ defaultAttributes [ 'href' ] = $ options [ 'path' ] ; } else { $ defaultAttributes [ 'type' ] = $ options [ 'type' ] ; } if ( array_key_exists ( 'class' , $ attributes ) ) { $ classes = array_merge ( $ classes , explode ( ' ' , $ attributes [ 'class' ] ) ) ; unset ( $ attributes [ 'class' ] ) ; } $ defaultAttributes [ 'class' ] = implode ( ' ' , $ classes ) ; $ attributes = array_merge ( $ defaultAttributes , $ attributes ) ; $ icon = '' ; if ( 0 < strlen ( $ options [ 'icon' ] ) ) { $ icon = $ options [ 'fa_icon' ] ? 'fa fa-' . $ options [ 'icon' ] : 'glyphicon glyphicon-' . $ options [ 'icon' ] ; } return $ this -> controlsTemplate -> renderBlock ( 'button' , [ 'tag' => $ tag , 'attr' => $ attributes , 'label' => $ label , 'icon' => $ icon , ] ) ; }
Renders the button.

@param string $label
@param array $options
@param array $attributes
@return string
@throws \InvalidArgumentException
Renders the button .