1 | <?php |
||
27 | class Widget extends BaseWidget |
||
28 | { |
||
29 | /** Name of inline JavaScript package that is registered by the widget */ |
||
30 | const INLINE_JS_KEY = 'the0rist/imperavi/'; |
||
31 | |||
32 | /** |
||
33 | * @var Model the data model that this widget is associated with. |
||
34 | */ |
||
35 | public $model; |
||
36 | |||
37 | /** |
||
38 | * @var string the model attribute that this widget is associated with. |
||
39 | */ |
||
40 | public $attribute; |
||
41 | |||
42 | /** |
||
43 | * @var string the input name. This must be set if [[model]] and [[attribute]] are not set. |
||
44 | */ |
||
45 | public $name; |
||
46 | |||
47 | /** |
||
48 | * @var string the input value. |
||
49 | */ |
||
50 | public $value; |
||
51 | |||
52 | /** |
||
53 | * @var string|null Selector pointing to textarea to initialize redactor for. |
||
54 | * Defaults to null meaning that textarea does not exist yet and will be |
||
55 | * rendered by this widget. |
||
56 | */ |
||
57 | public $selector; |
||
58 | |||
59 | /** |
||
60 | * @var array the HTML attributes for the input tag. |
||
61 | * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. |
||
62 | */ |
||
63 | public $options = []; |
||
64 | |||
65 | /** |
||
66 | * @var array {@link http://imperavi.com/redactor/docs/ redactor options}. |
||
67 | */ |
||
68 | public $settings = []; |
||
69 | |||
70 | /** |
||
71 | * @var array Default settings that will be merged with {@link $settings}. Useful with DI container. |
||
72 | */ |
||
73 | public $defaultSettings = []; |
||
74 | |||
75 | /** |
||
76 | * This property must be used only for registering widget custom plugins. |
||
77 | * The key is the name of the plugin, and the value must be the class name of the plugin bundle. |
||
78 | * @var array Widget custom plugins key => value array |
||
79 | */ |
||
80 | public $plugins = []; |
||
81 | |||
82 | /** |
||
83 | * @var boolean Depends on this attribute textarea will be rendered or not |
||
84 | */ |
||
85 | private $_renderTextarea = true; |
||
86 | |||
87 | /** |
||
88 | * @inheritdoc |
||
89 | */ |
||
90 | public function init() |
||
124 | |||
125 | /** |
||
126 | * @inheritdoc |
||
127 | */ |
||
128 | public function run() |
||
140 | |||
141 | /** |
||
142 | * Register widget translations. |
||
143 | */ |
||
144 | public static function registerTranslations() |
||
157 | |||
158 | /** |
||
159 | * Register all widget logic. |
||
160 | */ |
||
161 | protected function register() |
||
167 | |||
168 | /** |
||
169 | * Register widget asset. |
||
170 | */ |
||
171 | protected function registerClientScripts() |
||
196 | |||
197 | /** |
||
198 | * Register default callbacks. |
||
199 | */ |
||
200 | protected function registerDefaultCallbacks() |
||
209 | |||
210 | /** |
||
211 | * @return boolean whether this widget is associated with a data model. |
||
212 | */ |
||
213 | protected function hasModel() |
||
217 | } |
||
218 |