YiiWheels
  • Package
  • Class
  • Tree

Packages

  • None
  • yiiwheels
    • behaviors
    • widgets
    • widgets
      • ace
      • box
      • datepicker
      • daterangepicker
      • datetimepicker
      • detail
      • fileupload
      • fileuploader
      • gallery
      • google
      • grid
        • behaviors
        • operations
      • highcharts
      • maskInput
      • maskmoney
      • modal
      • multiselect
      • rangeslider
      • redactor
      • select2
      • sparklines
      • switch
      • timeago
      • timepicker
      • toggle
      • typeahead

Classes

  • WhCountries
  • WhDatePickerHelper
  • WhDropDownInputWidget
  • WhFonts
  • WhFontSizes
  • WhGoogleFonts
  • WhInputWidget
  • WhLanguages
  • WhPhone
  • WhSelectBox
  • WhStates
  • WhTimePickerHelper
  • WhTimezones
 1 <?php
 2 /**
 3  *
 4  * WhDropdownInputWidget.php
 5  *
 6  * Date: 06/09/14
 7  * Time: 14:19
 8  * @author Antonio Ramirez <amigo.cobos@gmail.com>
 9  * @link http://www.ramirezcobos.com/
10  * @link http://www.2amigos.us/
11  */
12 Yii::import('yiiwheels.widgets.formhelpers.WhInputWidget');
13 
14 class WhDropDownInputWidget extends WhInputWidget
15 {
16     /**
17      * @var bool whether to use [[Select]] or not
18      */
19     public $useHelperSelectBox = false;
20 
21     /**
22      * Renders a dropdown list for the helper
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 } 
YiiWheels API documentation generated by ApiGen 2.8.0