src/View/Helper/HtmlHelper.php
public function progress($widths, array $options = []) {
        $options += $this->getConfig('progress') + [
            'striped' => false,
            'active'  => false,
            'min' => 0,
            'max' => 100,
            'templateVars' => []
        ];
        if (!is_array($widths)) {
            $widths = [
                ['width' => $widths]
            ];
        }
        $bars = '';
        foreach ($widths as $width) {
            $width += $options;
            if ($width['striped']) {
                $width = $this->addClass($width, 'progress-bar-striped');
            }
            if ($width['active']) {
                $width = $this->addClass($width, 'active');
            }
            $inner = $this->formatTemplate('progressBarInner', [
                'width' => $width['width']
            ]);

            $bars .= $this->formatTemplate('progressBar', [
                'inner' => $inner,
                'type' => $width['type'],
                'min' => $width['min'],
                'max' => $width['max'],
                'width' => $width['width'],
                'attrs' => $this->templater()->formatAttributes($width, ['striped', 'active', 'min', 'max', 'type', 'width']),
                'templateVars' => $width['templateVars']
            ]);
        }
        return $this->formatTemplate('progressBarContainer', [
            'content' => $bars,
            'attrs' => $this->templater()->formatAttributes([]),
            'templateVars' => $options['templateVars']
        ]);
    }
public function progress($widths, array $options = []) {
        $options += $this->getConfig('progress') + [
            'striped' => false,
            'active'  => false,
            'min' => 0,
            'max' => 100,
            'templateVars' => []
        ];
        if (!is_array($widths)) {
            $widths = [
                ['width' => $widths]
            ];
        }
        $bars = '';
        foreach ($widths as $width) {
            $width += $options;
            if ($width['striped']) {
                $width = $this->addClass($width, 'progress-bar-striped');
            }
            if ($width['active']) {
                $width = $this->addClass($width, 'active');
            }
            $inner = $this->formatTemplate('progressBarInner', [
                'width' => $width['width']
            ]);

            $bars .= $this->formatTemplate('progressBar', [
                'inner' => $inner,
                'type' => $width['type'],
                'min' => $width['min'],
                'max' => $width['max'],
                'width' => $width['width'],
                'attrs' => $this->templater()->formatAttributes($width, ['striped', 'active', 'min', 'max', 'type', 'width']),
                'templateVars' => $width['templateVars']
            ]);
        }
        return $this->formatTemplate('progressBarContainer', [
            'content' => $bars,
            'attrs' => $this->templater()->formatAttributes([]),
            'templateVars' => $options['templateVars']
        ]);
    }
public function progress ( $ widths , array $ options = [ ] ) { $ options += $ this -> getConfig ( 'progress' ) + [ 'striped' => false , 'active' => false , 'min' => 0 , 'max' => 100 , 'templateVars' => [ ] ] ; if ( ! is_array ( $ widths ) ) { $ widths = [ [ 'width' => $ widths ] ] ; } $ bars = '' ; foreach ( $ widths as $ width ) { $ width += $ options ; if ( $ width [ 'striped' ] ) { $ width = $ this -> addClass ( $ width , 'progress-bar-striped' ) ; } if ( $ width [ 'active' ] ) { $ width = $ this -> addClass ( $ width , 'active' ) ; } $ inner = $ this -> formatTemplate ( 'progressBarInner' , [ 'width' => $ width [ 'width' ] ] ) ; $ bars .= $ this -> formatTemplate ( 'progressBar' , [ 'inner' => $ inner , 'type' => $ width [ 'type' ] , 'min' => $ width [ 'min' ] , 'max' => $ width [ 'max' ] , 'width' => $ width [ 'width' ] , 'attrs' => $ this -> templater ( ) -> formatAttributes ( $ width , [ 'striped' , 'active' , 'min' , 'max' , 'type' , 'width' ] ) , 'templateVars' => $ width [ 'templateVars' ] ] ) ; } return $ this -> formatTemplate ( 'progressBarContainer' , [ 'content' => $ bars , 'attrs' => $ this -> templater ( ) -> formatAttributes ( [ ] ) , 'templateVars' => $ options [ 'templateVars' ] ] ) ; }
Create a Twitter Bootstrap style progress bar.

### Bar options:

- `active` If `true` the progress bar will be active. Default is `false`.
- `max` Maximum value for the progress bar. Default is `100`.
- `min` Minimum value for the progress bar. Default is `0`.
- `striped` If `true` the progress bar will be striped. Default is `false`.
- `type` A string containing the `type` of the progress bar (primary, info, danger,
success, warning). Default to `'primary'`.
- `templateVars` Provide template variables for the `progressBar` template.
- Other attributes will be assigned to the progress bar element.

@param int|array $widths
- `int` The width (in %) of the bar.
- `array` An array of bars, with, for each bar, the following fields:
- `width` **required** The width of the bar.
- Other options possible (see above).
@param array $options Array of options. See above.

@return string The HTML bootstrap progress bar.
Create a Twitter Bootstrap style progress bar .