1 <?php
2 3 4 5 6 7 8 9 10 11
12 Yii::import('yiiwheels.widgets.formhelpers.WhInputWidget');
13
14 class WhSelectBox extends WhInputWidget
15 {
16 17 18 19
20 public $data = array();
21
22 23 24
25 public function init()
26 {
27 parent::init();
28 TbHtml::addCssClass('bfh-selectbox', $this->htmlOptions);
29 }
30
31 32 33
34 public function run()
35 {
36 $input[] = CHtml::openTag('div', $this->htmlOptions);
37 foreach ($this->data as $key => $value) {
38 $input[] = CHtml::tag('div', ['data-value' => (string)$key], (string)$value);
39 }
40 $input[] = CHtml::closeTag('div');
41
42 echo implode("\n", $input);
43
44 $this->registerPlugin('bfhselectbox');
45 }
46 }