Completed
Push — master ( 732a3f...09ab70 )
by Sergio
12:36
created
src/Pell.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -85,25 +85,25 @@  discard block
 block discarded – undo
85 85
         parent::init();
86 86
 
87 87
         //Attribute id in textarea must be set
88
-        if(!isset($this->inputOptions['id']) && true === $this->asFormPart){
88
+        if (!isset($this->inputOptions['id']) && true === $this->asFormPart) {
89 89
             $pell = $this->clientPluginInstanceName;
90 90
             $this->inputOptions['id'] = "$pell-textarea-" . $this->getId();
91 91
         }
92 92
 
93 93
         //In Html::textarea attribute name must be set
94
-        if(!$this->name && true === $this->asFormPart && false === $this->hasModel()){
94
+        if (!$this->name && true === $this->asFormPart && false === $this->hasModel()) {
95 95
             throw new InvalidArgumentException("Param 'name' must be specified for textarea attribute name.");
96 96
         }
97 97
 
98
-        if(!isset($this->wrapperOptions['tag'])){
98
+        if (!isset($this->wrapperOptions['tag'])) {
99 99
             $this->wrapperOptions['tag'] = 'div';
100 100
         }
101 101
 
102
-        if(!isset($this->wrapperOptions['id'])){
102
+        if (!isset($this->wrapperOptions['id'])) {
103 103
             $this->wrapperOptions['id'] = $this->getWrapperId();
104 104
         }
105 105
 
106
-        if(!isset($this->wrapperOptions['class'])){
106
+        if (!isset($this->wrapperOptions['class'])) {
107 107
             //From yii\widgets\ActiveField [$inputOptions = ['class' => 'form-control']]
108 108
             $this->wrapperOptions['class'] = 'form-control';
109 109
 
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
         }
112 112
 
113 113
         //If widget is used as part of the form, setting [clientOptions['onChange']] from widget options not allowed
114
-        if(isset($this->clientOptions['onChange']) && $this->asFormPart){
114
+        if (isset($this->clientOptions['onChange']) && $this->asFormPart) {
115 115
             throw new InvalidArgumentException("Param 'onChange' cannot be specified if the widget is used as part of the form.");
116 116
         }
117 117
 
118
-        if(isset($this->clientOptions['element'])){
118
+        if (isset($this->clientOptions['element'])) {
119 119
             throw new InvalidArgumentException("Param 'element' cannot be specified. This param set by widget.");
120 120
         }
121 121
     }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         $content = null;
140 140
 
141 141
         //If [$this->asFormPart === true] then create hidden textarea inside wrapper to seva passed data
142
-        if($this->asFormPart){
142
+        if ($this->asFormPart) {
143 143
             $content = $this->getTextArea();
144 144
         }
145 145
         
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $this->clientOptions['element'] = $element;
164 164
         
165 165
         //If widget used inside form and needed generete [Html::textarea] or [Html::activeTextarea]
166
-        if($this->asFormPart){
166
+        if ($this->asFormPart) {
167 167
             $textAreaId = $this->getTextAreaId();
168 168
             //Write content from editor to hidden texarea when that was changed
169 169
             $this->clientOptions['onChange'] = new JsExpression(
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
         $editorJsVar = "{$pell}Editor_" . $this->getId();
181 181
 
182 182
         //Init plugin javascript
183
-        $js[] = "";//set \n
183
+        $js[] = ""; //set \n
184 184
         $js[] = "const $editorJsVar = $pell.init($clientOptions);";
185 185
         
186 186
         //If isset default value like value from db, or if set `$this->value`
187
-        if($this->hasDefaultValue()){
187
+        if ($this->hasDefaultValue()) {
188 188
             $defVal = $this->getDefaultValue();
189 189
 
190 190
             //Pass value to editor
191 191
             $js[] = new JsExpression("$editorJsVar.content.innerHTML = `$defVal`");
192 192
         }
193
-        $js[] = "";//set \n
193
+        $js[] = ""; //set \n
194 194
 
195 195
         return implode("\n", $js);
196 196
     }    
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
         if ($this->hasModel()) {
225 225
             $textarea = Html::activeTextarea($this->model, $this->attribute, $this->inputOptions);
226
-        } else {
226
+        }else {
227 227
             $textarea = Html::textarea($this->name, $this->value, $this->inputOptions);
228 228
         }
229 229
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     public function getWrapperId()
239 239
     {
240 240
         $pell = $this->clientPluginInstanceName;
241
-        return "$pell-wrap-". $this->getId();
241
+        return "$pell-wrap-" . $this->getId();
242 242
     }
243 243
 
244 244
     public function getWrapperClass()
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     {
276 276
         if ($this->hasModel()) {
277 277
             $value = Html::getAttributeValue($this->model, $this->attribute);
278
-        } else {
278
+        }else {
279 279
             $value = $this->value;
280 280
         }
281 281
 
Please login to merge, or discard this patch.