Completed
Push — master ( 6a79a8...0ac66f )
by Antonio
04:03
created

ReloadButton   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 32
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 6 1
A registerClientScript() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-grid-view-library project.
5
 * (c) 2amigOS! <http://2amigos.us/>
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace dosamigos\grid\buttons;
11
12
use dosamigos\grid\bundles\ToolbarButtonAsset;
13
use dosamigos\grid\contracts\RegistersClientScriptInterface;
14
use yii\bootstrap\Button;
15
use yii\web\JsExpression;
16
17
class ReloadButton extends Button implements RegistersClientScriptInterface
18
{
19
    /**
20
     * @var string the button label
21
     */
22
    public $label = '<i class="glyphicon glyphicon-refresh"></i>';
23
    /**
24
     * @var boolean whether the label should be HTML-encoded.
25
     */
26
    public $encodeLabel = false;
27
28
    /**
29
     * Renders the widget.
30
     */
31
    public function run()
32
    {
33
        $this->registerClientScript();
34
35
        return parent::run();
36
    }
37
38
    /**
39
     * @inheritdoc
40
     */
41
    public function registerClientScript()
42
    {
43
        $view = $this->getView();
44
        ToolbarButtonAsset::register($view);
45
46
        $this->clientEvents['click.reloadButton'] = new JsExpression('dosamigos.toolbarButtons.reload');
47
    }
48
}
49