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.WhInputWidget');
13 
14 class WhPhone extends WhInputWidget
15 {
16     /**
17      * @var string the formatting options
18      */
19     public $format = false;
20 
21     public function init()
22     {
23         parent::init();
24         TbHtml::addCssClass('bfh-phone', $this->htmlOptions);
25 
26         $this->htmlOptions['data-format'] = $this->format;
27 
28         unset($this->htmlOptions['data-name'], $this->htmlOptions['data-value']);
29     }
30 
31     public function run()
32     {
33         if (!$this->readOnly) {
34             echo $this->hasModel()
35                 ? CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions)
36                 : CHtml::textField($this->name, $this->value, $this->htmlOptions);
37         } else {
38             $this->htmlOptions['data-number'] = $this->hasModel()
39                 ? $this->model->{$this->attribute}
40                 : $this->value;
41             echo CHtml::tag('span', $this->htmlOptions, '');
42         }
43 
44         $this->registerPlugin('bfhphone');
45     }
46 }
YiiWheels API documentation generated by ApiGen 2.8.0