1 <?php
2 3 4 5 6 7 8 9 10 11
12 Yii::import('yiiwheels.widgets.formhelpers.WhInputWidget');
13
14 class WhDropDownInputWidget extends WhInputWidget
15 {
16 17 18
19 public $useHelperSelectBox = false;
20
21 22 23
24 protected function dropDownList()
25 {
26 if (!$this->useHelperSelectBox) {
27 return $this->hasModel()
28 ? CHtml::activeDropDownList($this->model, $this->attribute, array(), $this->htmlOptions)
29 : CHtml::dropDownList($this->name, $this->value, array(), $this->htmlOptions);
30 } else {
31
32
33 ob_start();
34 ob_implicit_flush(false);
35 try {
36 $widget = Yii::createComponent(
37 array(
38 'class' => 'yiiwheels.widgets.formhelpers.WhSelectBox',
39 'model' => $this->model,
40 'attribute' => $this->attribute,
41 'name' => $this->name,
42 'value' => $this->value,
43 'htmlOptions' => $this->htmlOptions,
44 )
45 );
46 $widget->init();
47 $widget->run();
48 } catch (Exception $e) {
49 ob_end_clean();
50 throw $e;
51 }
52 return ob_get_clean();
53 }
54 }
55
56 }