SubmitButton::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @link https://github.com/DMGPage/yii2-materialize
4
 * @copyright Copyright (c) 2018 Dmitrijs Reinmanis
5
 * @license https://github.com/DMGPage/yii2-materialize/blob/master/LICENSE
6
 */
7
8
namespace dmgpage\yii2materialize\widgets;
9
10
use dmgpage\yii2materialize\widgets\Button;
11
12
/**
13
 * Button renders a Materialize button with type "submit".
14
 *
15
 * For example,
16
 *
17
 * ```php
18
 * echo SubmitButton::widget([
19
 *     'waves' => Waves::LIGHT,
20
 *     'icon' => [
21
 *         'name' => 'alarm',
22
 *         'position' => Position::LEFT,
23
 *         'options' =>  ['class' => 'red'],
24
 *     ]
25
 * ]);
26
 * ```
27
 * @see https://materializecss.com/buttons.html#submit
28
 * @package widgets
29
 */
30
class SubmitButton extends Button
31
{
32
    /**
33
     * @var string the button label. Set to "false", if you do not want a label text to be rendered
34
     */
35
    public $label = 'Submit';
36
37
    /**
38
     * Initializes the widget.
39
     */
40
    public function init()
41
    {
42
        $this->options['type'] = 'submit';
43
        parent::init();
44
    }
45
46
    /**
47
     * Executes the widget.
48
     *
49
     * @return string the rendered markup.
50
     */
51
    public function run()
52
    {
53
        return parent::run();
54
    }
55
}
56