1 <?php
2 3 4 5 6 7 8 9 10 11
12 Yii::import('yiiwheels.widgets.formhelpers.WhDropDownInputWidget');
13
14 class WhCountries extends WhDropDownInputWidget
15 {
16
17 public function init()
18 {
19 parent::init();
20 TbHtml::addCssClass('bfh-countries', $this->htmlOptions);
21
22 if(!isset($this->htmlOptions['data-country'])) {
23 $this->htmlOptions['data-country'] = TbArray::popValue('data-value', $this->htmlOptions);
24 }
25 unset($this->htmlOptions['data-name'], $this->htmlOptions['data-value']);
26 }
27
28 public function run()
29 {
30 if(!$this->readOnly) {
31 echo $this->dropDownList();
32 } else
33 {
34 echo CHtml::tag('span', $this->htmlOptions, '');
35 }
36
37 $this->registerPlugin('bfhcountries');
38 }
39 }