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  * WhCountries.php
 5  *
 6  * Date: 06/09/14
 7  * Time: 14:17
 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.WhDropDownInputWidget');
13 
14 class WhStates extends WhDropDownInputWidget
15 {
16     /**
17      * @var string the two letter country code or ID of a bfh-countries HTML element. To filter based on a country.
18      * It is required.
19      */
20     public $country;
21 
22     public function init()
23     {
24         if (empty($this->country)) {
25             throw new CException('"$country" cannot be empty.');
26         }
27         $this->pluginOptions['country'] = $this->country;
28 
29         parent::init();
30 
31         TbHtml::addCssClass('bfh-states', $this->htmlOptions);
32 
33         if(!isset($this->htmlOptions['data-state'])) {
34             $this->htmlOptions['data-state'] = TbArray::popValue('data-value', $this->htmlOptions);
35         }
36         unset($this->htmlOptions['data-name'], $this->htmlOptions['data-value']);
37     }
38 
39     public function run()
40     {
41         if(!$this->readOnly) {
42             echo $this->dropDownList();
43         } else
44         {
45             echo CHtml::tag('span', $this->htmlOptions, '');
46         }
47 
48         $this->registerPlugin('bfhstates');
49     }
50 }
YiiWheels API documentation generated by ApiGen 2.8.0