protected function renderBar($config = [], $label, $options = []) {
        $percent = ArrayHelper::getValue($config, 'percent', 0);
        $animated = ArrayHelper::getValue($config, 'animated', false);
        $striped = ArrayHelper::getValue($config, 'striped', false) || $animated;
        $percentFixed = number_format($percent, 2, '.', '');
        $defaultOptions = [
            'role' => 'progressbar',
            'aria-valuenow' => $percent,
            'aria-valuemin' => 0,
            'aria-valuemax' => 100,
            'style' => "width:{$percentFixed}%",
        ];
        $options = array_merge($defaultOptions, $options);
        Html::addCssClass($options, ['widget' => 'progress-bar']);
        if ($animated) {
            Html::addCssClass($options, ['animated' => 'progress-bar-animated']);
        }
        if ($striped) {
            Html::addCssClass($options, ['striped' => 'progress-bar-striped']);
        }

        $out = $this->htmlHlp->beginTag('div', $options);
        $out .= $label;
        $out .= $this->htmlHlp->tag('span', \Reaction::t('rct', '{percent}% Complete', ['percent' => $percent]), [
            'class' => 'sr-only'
        ]);
        $out .= Html::endTag('div');

        return $out;
    }
protected function renderBar($config = [], $label, $options = []) {
        $percent = ArrayHelper::getValue($config, 'percent', 0);
        $animated = ArrayHelper::getValue($config, 'animated', false);
        $striped = ArrayHelper::getValue($config, 'striped', false) || $animated;
        $percentFixed = number_format($percent, 2, '.', '');
        $defaultOptions = [
            'role' => 'progressbar',
            'aria-valuenow' => $percent,
            'aria-valuemin' => 0,
            'aria-valuemax' => 100,
            'style' => "width:{$percentFixed}%",
        ];
        $options = array_merge($defaultOptions, $options);
        Html::addCssClass($options, ['widget' => 'progress-bar']);
        if ($animated) {
            Html::addCssClass($options, ['animated' => 'progress-bar-animated']);
        }
        if ($striped) {
            Html::addCssClass($options, ['striped' => 'progress-bar-striped']);
        }

        $out = $this->htmlHlp->beginTag('div', $options);
        $out .= $label;
        $out .= $this->htmlHlp->tag('span', \Reaction::t('rct', '{percent}% Complete', ['percent' => $percent]), [
            'class' => 'sr-only'
        ]);
        $out .= Html::endTag('div');

        return $out;
    }
protected function renderBar ( $ config = [ ] , $ label , $ options = [ ] ) { $ percent = ArrayHelper :: getValue ( $ config , 'percent' , 0 ) ; $ animated = ArrayHelper :: getValue ( $ config , 'animated' , false ) ; $ striped = ArrayHelper :: getValue ( $ config , 'striped' , false ) || $ animated ; $ percentFixed = number_format ( $ percent , 2 , '.' , '' ) ; $ defaultOptions = [ 'role' => 'progressbar' , 'aria-valuenow' => $ percent , 'aria-valuemin' => 0 , 'aria-valuemax' => 100 , 'style' => "width:{$percentFixed}%" , ] ; $ options = array_merge ( $ defaultOptions , $ options ) ; Html :: addCssClass ( $ options , [ 'widget' => 'progress-bar' ] ) ; if ( $ animated ) { Html :: addCssClass ( $ options , [ 'animated' => 'progress-bar-animated' ] ) ; } if ( $ striped ) { Html :: addCssClass ( $ options , [ 'striped' => 'progress-bar-striped' ] ) ; } $ out = $ this -> htmlHlp -> beginTag ( 'div' , $ options ) ; $ out .= $ label ; $ out .= $ this -> htmlHlp -> tag ( 'span' , \ Reaction :: t ( 'rct' , '{percent}% Complete' , [ 'percent' => $ percent ] ) , [ 'class' => 'sr-only' ] ) ; $ out .= Html :: endTag ( 'div' ) ; return $ out ; }
Generates a bar
@param array $config the bar config (percentage, striped, animated)
@param string $label, optional, the label to display at the bar
@param array $options the HTML attributes of the bar
@return string the rendering result.
Generates a bar