Class yii\bootstrap4\Progress
| Inheritance | yii\bootstrap4\Progress » yii\bootstrap4\Widget » yii\base\Widget | 
|---|---|
| Uses Traits | yii\bootstrap4\BootstrapWidgetTrait | 
Progress renders a bootstrap progress bar component.
For example,
// default with label
echo Progress::widget([
    'percent' => 60,
    'label' => 'test',
]);
// styled
echo Progress::widget([
    'bars' => [
        ['percent' => 65, 'options' => ['class' => 'bg-danger']]
    ]
]);
// striped
echo Progress::widget([
    'bars' => [
        ['percent' => 70, 'options' => ['class' => 'bg-warning progress-bar-striped']]
    ]
]);
// striped animated
echo Progress::widget([
    'percent' => 70,
    'options' => ['class' => 'bg-success progress-bar-animated progress-bar-striped']
]);
// stacked bars
echo Progress::widget([
    'bars' => [
        ['percent' => 30, 'options' => ['class' => 'bg-danger']],
        ['percent' => 30, 'label' => 'test', 'options' => ['class' => 'bg-success']],
        ['percent' => 35, 'options' => ['class' => 'bg-warning']],
    ]
]);
See also https://getbootstrap.com/docs/4.2/components/progress/.
Public Properties
| Property | Type | Description | Defined By | 
|---|---|---|---|
| $bars | array | A set of bars that are stacked together to form a single progress bar. | yii\bootstrap4\Progress | 
| $clientEvents | array | The event handlers for the underlying Bootstrap JS plugin. | yii\bootstrap4\BootstrapWidgetTrait | 
| $clientOptions | array | The options for the underlying Bootstrap JS plugin. | yii\bootstrap4\BootstrapWidgetTrait | 
| $label | string | The button label. | yii\bootstrap4\Progress | 
| $options | array | The HTML attributes for the widget container tag. | yii\bootstrap4\Widget | 
| $percent | integer | The amount of progress as a percentage. | yii\bootstrap4\Progress | 
Public Methods
| Method | Description | Defined By | 
|---|---|---|
| getView() | yii\bootstrap4\BootstrapWidgetTrait | |
| init() | Initializes the widget. | yii\bootstrap4\Progress | 
| run() | yii\bootstrap4\Progress | 
Protected Methods
| Method | Description | Defined By | 
|---|---|---|
| registerClientEvents() | Registers JS event handlers that are listed in $clientEvents. | yii\bootstrap4\BootstrapWidgetTrait | 
| registerPlugin() | Registers a specific Bootstrap plugin and the related events | yii\bootstrap4\BootstrapWidgetTrait | 
| renderBar() | Generates a bar | yii\bootstrap4\Progress | 
| renderProgress() | Renders the progress. | yii\bootstrap4\Progress | 
Property Details
A set of bars that are stacked together to form a single progress bar. Each bar is an array of the following structure:
[
    // required, the amount of progress as a percentage.
    'percent' => 30,
    // optional, the label to be displayed on the bar
    'label' => '30%',
    // optional, array, additional HTML attributes for the bar tag
    'options' => [],
]
The button label.
The amount of progress as a percentage.
Method Details
Initializes the widget.
This method will register the bootstrap asset bundle. If you override this method, make sure you call the parent implementation first.
| public void init ( ) | 
Generates a bar
| protected string renderBar ( $percent, $label = '', $options = [] ) | ||
| $percent | integer | The percentage of the bar | 
| $label | string | , optional, the label to display at the bar | 
| $options | array | The HTML attributes of the bar | 
| return | string | The rendering result. | 
|---|---|---|
Renders the progress.
| protected string renderProgress ( ) | ||
| return | string | The rendering result. | 
|---|---|---|
| throws | \yii\base\InvalidConfigException | if the "percent" option is not set in a stacked progress bar. | 
| public void run ( ) | ||
| throws | \yii\base\InvalidConfigException | |
|---|---|---|