@@ -85,25 +85,25 @@ discard block |
||
| 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 | - $this->inputOptions['id'] = "$pell-textarea-" . $this->getId(); |
|
| 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 |
||
| 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 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function run() |
| 127 | 127 | { |
| 128 | - echo $this->renderWidget() . "\n"; |
|
| 128 | + echo $this->renderWidget()."\n"; |
|
| 129 | 129 | $js = $this->buildClientScript(); |
| 130 | 130 | $this->registerClientScript($js); |
| 131 | 131 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 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 |
||
| 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( |
@@ -177,20 +177,20 @@ discard block |
||
| 177 | 177 | $pell = $this->clientPluginInstanceName; |
| 178 | 178 | |
| 179 | 179 | //Editor js instance constant name |
| 180 | - $editorJsVar = "{$pell}Editor_" . $this->getId(); |
|
| 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 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 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() |