-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScrollableBox.php
79 lines (71 loc) · 1.55 KB
/
ScrollableBox.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
<?php
namespace demogorgorn\uikit;
use Yii;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
/**
* Panel-like box which has a max-height and provides a vertical scrollbar.
*
* For example,
*
* ```php
* echo ScrollableBox::widget([
* 'body' => 'Say hello...',
* ]);
* ```
*
* The following example will show the content enclosed between the [[begin()]]
* and [[end()]] calls within the ScrollableBox:
*
* ```php
* ScrollableBox::begin();
*
* echo 'Say hello...';
*
* ScrollableBox::end();
* ```
*
* Using options:
*
* ```php
* ScrollableBox::begin([
* 'options' => ['class' => 'customclass'],
* ]);
*
* echo 'Say hello...';
*
* ScrollableBox::end();
* ```
*
* @see http://www.getuikit.com/docs/utility.html
* @author Oleg Martemjanov <[email protected]>
* @since 2.0
*
*/
class ScrollableBox extends Widget
{
/**
* @var string the body content in the ScrollableBox component. Note that anything between
* the [[begin()]] and [[end()]] calls of the ScrollableBox widget will also be treated
* as the body content, and will be rendered before this.
*/
public $body;
/**
* Initializes the widget.
*/
public function init()
{
parent::init();
Html::addCssClass($this->options, 'uk-scrollable-box');
echo Html::beginTag('div', $this->options) . "\n";
}
/**
* Renders the widget.
*/
public function run()
{
echo "\n" . $this->body;
echo "\n" . Html::endTag('div');
$this->registerAsset();
}
}