-
Notifications
You must be signed in to change notification settings - Fork 22
/
Callout.php
102 lines (89 loc) · 1.88 KB
/
Callout.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
namespace insolita\wgadminlte;
use yii\bootstrap\Widget;
use yii\helpers\Html;
/**
* Class Callout
*
* @example
* <?php
* Callout::widget(['type'=>'info','head'=>'Soma Head','text'=>'some message']);
* ?>
* Also possible
* <?php Callout::begin(['type'=>'info','head'=>'Soma Head'])?>
* Some body content
* <?php Callout::end();?>
* @package insolita\wgadminlte
*/
class Callout extends Widget
{
/**
* @deprecated use LteConst instead
*/
const TYPE_WARNING = 'warning';
/**
* @deprecated use LteConst instead
*/
const TYPE_DANGER = 'danger';
/**
* @deprecated use LteConst instead
*/
const TYPE_INFO = 'info';
/**
* @deprecated use LteConst instead
*/
const TYPE_DEFAULT = 'default';
/**
* @var string $type color style of widget
*/
public $type = LteConst::TYPE_INFO;
/**
* @var string $head *
*/
public $head = '';
/**
* @var string $text your message
**/
public $text = '';
/**
* @var string
*/
public $topTemplate
= <<<HTML
<div {options}><h4>{head}</h4><p>
HTML;
/**
* @var string
*/
public $endTemplate
= <<<HTML
</p></div>
HTML;
/**
* @inheritdoc
*/
public $options = [];
public function init()
{
parent::init();
Html::addCssClass($this->options, 'callout');
Html::addCssClass($this->options, 'callout-' . $this->type);
echo strtr(
$this->topTemplate,
[
'{options}' => Html::renderTagAttributes($this->options),
'{head}' => $this->head,
]
);
if ($this->text) {
echo $this->text;
}
}
/**
*
*/
public function run()
{
return $this->endTemplate;
}
}