Blame view

vendor/kartik-v/yii2-krajee-base/Widget.php 1.79 KB
583ea05f   andryeyev   + widget-select2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  <?php
  
  /**
   * @package   yii2-krajee-base
   * @author    Kartik Visweswaran <kartikv2@gmail.com>
   * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
   * @version   1.7.7
   */
  
  namespace kartik\base;
  
  use Yii;
  
  /**
   * Base widget class for Krajee extensions
   *
   * @author Kartik Visweswaran <kartikv2@gmail.com>
   * @since  1.0
   */
  class Widget extends \yii\base\Widget
  {
      use TranslationTrait;
      use WidgetTrait;
  
      /**
       * @var array HTML attributes or other settings for widgets
       */
      public $options = [];
  
      /**
       * @var array widget plugin options
       */
      public $pluginOptions = [];
  
      /**
       * @var array widget JQuery events. You must define events in
       * event-name => event-function format
       * for example:
       * ~~~
       * pluginEvents = [
       *     "change" => "function() { log("change"); }",
       *     "open" => "function() { log("open"); }",
       * ];
       * ~~~
       */
      public $pluginEvents = [];
  
      /**
       * @var array the the internalization configuration for this widget
       */
      public $i18n = [];
  
      /**
       * @var string translation message file category name for i18n
       */
      protected $_msgCat = '';
  
      /**
       * @var string the name of the jQuery plugin
       */
      protected $_pluginName;
  
      /**
       * @var string the hashed global variable name storing the pluginOptions
       */
      protected $_hashVar;
  
      /**
       * @var string the element's HTML5 data variable name storing the pluginOptions
       */
      protected $_dataVar;
  
      /**
       * @var string the Json encoded options
       */
      protected $_encOptions = '';
  
      /**
       * @inheritdoc
       */
      public function init()
      {
          parent::init();
          if (empty($this->options['id'])) {
              $this->options['id'] = $this->getId();
          }
      }
  }