Skip to content
VMBindraban edited this page Mar 4, 2013 · 5 revisions

The SxBootstap button view helper shows a button made with the twitter bootstrap. The following syntax builds the button. It is possible to chain types.

<?php
// available parameters: string, array, object
echo $this->sxbButton('Click me!');
?>

Explicit usage

<?php
$options = array(
    'name'              => 'buttonName',
    'id'                => 'buttonID',
    'data-loading-text' => 'Loading..',
    'data-toggle'       => 'button',
);
echo $this->sxbButton($options));
?>

Using Zend button for sxbButton

<?php
$button = new \Zend\Form\Element\Button('buttonLabel');
$button->setLabel('sxbButton');
echo $this->sxbButton($button);
?>

Using Zend submit for sxbButton

<?php
$buttonSubmit = new \Zend\Form\Element\Submit('submitButtonLabel');
echo $this->sxbButton($buttonSubmit);
?>

Class types

<?php
// info, danger, warning, success, inverse, primary, link, disabled, mini, small, large, block, 
echo $this->sxbButton('Click me!')->info();
echo $this->sxbButton('Click me!')->success()->small()->disabled();
?>

Data types

<?php
// loadingText, toggle
echo $this->sxbButton('Click me!')->toggle('button');
echo $this->sxbButton('Click me!')->loadingText('Loading...');
?>

Content types

<?php
// setLabel, addClass, addAttribute
echo $this->sxbButton()->setLabel('Click me!');
echo $this->sxbButton('Click me!')->addClass('ButtonClass');
echo $this->sxbButton('Click me!')->addAttribute('key', 'value');
?>
Clone this wiki locally