forked from kartik-v/yii2-krajee-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWidget.php
103 lines (86 loc) · 2.32 KB
/
Widget.php
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* @package yii2-krajee-base
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2016
* @version 1.8.5
*/
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 string the javascript that will be used to destroy the jQuery plugin
*/
public $pluginDestroyJs;
/**
* @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 string the name of the jQuery plugin
*/
public $pluginName = '';
/**
* @var string a pjax container identifier if applicable inside which the widget will be rendered. If this is set,
* the widget will automatically reinitialize on pjax completion.
*/
public $pjaxContainerId;
/**
* @var bool enable pop state fix for pjax container on press of browser back & forward buttons
*/
public $enablePopStateFix = true;
/**
* @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 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();
}
$this->initDestroyJs();
}
}