TbHtml::bar PHP Method

bar() protected static method

Generates a progress bar.
protected static bar ( integer $width, array $htmlOptions = [] ) : string
$width integer the progress in percent.
$htmlOptions array additional HTML attributes.
return string the generated bar.
    protected static function bar($width = 0, $htmlOptions = array())
    {
        self::addCssClass('progress-bar', $htmlOptions);
        $color = TbArray::popValue('color', $htmlOptions);
        if (!empty($color)) {
            self::addCssClass('progress-bar-' . $color, $htmlOptions);
        }
        if ($width < 0) {
            $width = 0;
        }
        if ($width > 100) {
            $width = 100;
        }
        if ($width > 0) {
            $width .= '%';
        }
        self::addCssStyle("width: {$width};", $htmlOptions);
        $content = TbArray::popValue('content', $htmlOptions, '');
        return self::tag('div', $htmlOptions, $content);
    }
TbHtml