@@ -75,11 +75,11 @@ |
||
| 75 | 75 | /** |
| 76 | 76 | * @inheritdoc |
| 77 | 77 | */ |
| 78 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 78 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 79 | 79 | { |
| 80 | 80 | if (isset($searchData[0])) { |
| 81 | 81 | $keys = explode(',', $searchData[0]); |
| 82 | - foreach($keys as $key) { |
|
| 82 | + foreach ($keys as $key) { |
|
| 83 | 83 | if (!empty($key) && $key !== 'null') { |
| 84 | 84 | $query->where($this->getDataKey(), 'like', $key); |
| 85 | 85 | } |
@@ -61,17 +61,17 @@ |
||
| 61 | 61 | 'toolbar' => [ |
| 62 | 62 | [ |
| 63 | 63 | 'name' => 'paragraph', |
| 64 | - 'items' => [ 'Bold', 'Italic', 'Underline', 'Link', 'Unlink', 'EmojiPanel', 'Source' ] |
|
| 64 | + 'items' => ['Bold', 'Italic', 'Underline', 'Link', 'Unlink', 'EmojiPanel', 'Source'] |
|
| 65 | 65 | ] |
| 66 | 66 | ] |
| 67 | 67 | ], |
| 68 | 68 | 'default' => [ |
| 69 | 69 | 'toolbar' => [ |
| 70 | - [ 'name' => 'paragraph', 'items' => [ 'Format', 'Bold', 'Italic', 'Underline', '-', 'Superscript', 'Subscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-', 'NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote'] ], |
|
| 71 | - [ 'name' => 'links', 'items' => [ 'Link', 'Unlink', 'Anchor', '-', 'EmojiPanel' ] ], |
|
| 72 | - [ 'name' => 'insert', 'items' => [ 'Image', 'SimpleImageUpload', 'Table', 'SpecialChar' ] ], |
|
| 73 | - [ 'name' => 'document', 'items' => ['Maximize' ] ], |
|
| 74 | - [ 'name' => 'source', 'items' => [ 'RemoveFormat', '-', 'Source' ] ] |
|
| 70 | + ['name' => 'paragraph', 'items' => ['Format', 'Bold', 'Italic', 'Underline', '-', 'Superscript', 'Subscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote']], |
|
| 71 | + ['name' => 'links', 'items' => ['Link', 'Unlink', 'Anchor', '-', 'EmojiPanel']], |
|
| 72 | + ['name' => 'insert', 'items' => ['Image', 'SimpleImageUpload', 'Table', 'SpecialChar']], |
|
| 73 | + ['name' => 'document', 'items' => ['Maximize']], |
|
| 74 | + ['name' => 'source', 'items' => ['RemoveFormat', '-', 'Source']] |
|
| 75 | 75 | ], |
| 76 | 76 | 'extraPlugins' => ['simpleImageUpload'], |
| 77 | 77 | ] |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | /** |
| 23 | 23 | * @inheritdoc |
| 24 | 24 | */ |
| 25 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
| 25 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
| 26 | 26 | { |
| 27 | 27 | // do a query |
| 28 | 28 | $ids = neon()->db->query()->from('firefly_file_manager')->select('uuid')->where(['like', 'name', $searchData])->column(); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param boolean $overwrite (optional) - whether to overwrite an existing field of the same name defaults to false |
| 85 | 85 | * @return fields\Field|Form|FormRepeater |
| 86 | 86 | */ |
| 87 | - abstract public function add($field, $defaults=[], $overwrite=false); |
|
| 87 | + abstract public function add($field, $defaults = [], $overwrite = false); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Adds a sub form box to the form |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param array $options |
| 94 | 94 | * @return IField|Form |
| 95 | 95 | */ |
| 96 | - public function addSubForm($name, $options=[]) |
|
| 96 | + public function addSubForm($name, $options = []) |
|
| 97 | 97 | { |
| 98 | 98 | if (is_object($name)) { |
| 99 | 99 | return $this->add($name); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param array $options |
| 110 | 110 | * @return IField|fields\Text |
| 111 | 111 | */ |
| 112 | - public function addFieldText($name, $options=[]) |
|
| 112 | + public function addFieldText($name, $options = []) |
|
| 113 | 113 | { |
| 114 | 114 | return $this->add($options, ['name' => $name, 'class' => 'text']); |
| 115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param array $options |
| 122 | 122 | * @return IField|fields\Password |
| 123 | 123 | */ |
| 124 | - public function addFieldPassword($name, $options=[]) |
|
| 124 | + public function addFieldPassword($name, $options = []) |
|
| 125 | 125 | { |
| 126 | 126 | return $this->add($options, ['name' => $name, 'class' => 'password']); |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param string $name |
| 133 | 133 | * @return IField|fields\Text |
| 134 | 134 | */ |
| 135 | - public function addFieldFile($name, $options=[]) |
|
| 135 | + public function addFieldFile($name, $options = []) |
|
| 136 | 136 | { |
| 137 | 137 | return $this->add($options, ['class' => 'file', 'name' => $name]); |
| 138 | 138 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @param string $name |
| 146 | 146 | * @return IField|fields\Text |
| 147 | 147 | */ |
| 148 | - public function addFieldImage($name, $options=[]) |
|
| 148 | + public function addFieldImage($name, $options = []) |
|
| 149 | 149 | { |
| 150 | 150 | return $this->add($options, ['class' => 'image', 'name' => $name]); |
| 151 | 151 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param string $name |
| 157 | 157 | * @return IField|fields\Email |
| 158 | 158 | */ |
| 159 | - public function addFieldEmail($name, $options=[]) |
|
| 159 | + public function addFieldEmail($name, $options = []) |
|
| 160 | 160 | { |
| 161 | 161 | return $this->add($options, ['class' => 'email', 'name' => $name]); |
| 162 | 162 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @param array $options |
| 169 | 169 | * @return IField|fields\Submit |
| 170 | 170 | */ |
| 171 | - public function addFieldSubmit($name, $options=[]) |
|
| 171 | + public function addFieldSubmit($name, $options = []) |
|
| 172 | 172 | { |
| 173 | 173 | return $this->add($options, ['class' => 'submit', 'name' => $name]); |
| 174 | 174 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param array $options |
| 181 | 181 | * @return IField|fields\Text |
| 182 | 182 | */ |
| 183 | - public function addFieldHidden($name, $options=[]) |
|
| 183 | + public function addFieldHidden($name, $options = []) |
|
| 184 | 184 | { |
| 185 | 185 | return $this->add($options, ['class' => 'hidden', 'name' => $name]); |
| 186 | 186 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param array $options |
| 193 | 193 | * @return IField|fields\Checkbox |
| 194 | 194 | */ |
| 195 | - public function addFieldCheckbox($name, $options=[]) |
|
| 195 | + public function addFieldCheckbox($name, $options = []) |
|
| 196 | 196 | { |
| 197 | 197 | return $this->add($options, ['class' => 'checkbox', 'name' => $name]); |
| 198 | 198 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param array $options |
| 205 | 205 | * @return IField|fields\Checkbox |
| 206 | 206 | */ |
| 207 | - public function addFieldCheckList($name, $options=[]) |
|
| 207 | + public function addFieldCheckList($name, $options = []) |
|
| 208 | 208 | { |
| 209 | 209 | return $this->add($options, ['class' => 'checklist', 'name' => $name]); |
| 210 | 210 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @param array $options |
| 217 | 217 | * @return IField|fields\Date |
| 218 | 218 | */ |
| 219 | - public function addFieldDate($name, $options=[]) |
|
| 219 | + public function addFieldDate($name, $options = []) |
|
| 220 | 220 | { |
| 221 | 221 | return $this->add($options, ['name' => $name, 'class' => 'date']); |
| 222 | 222 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @param array $options |
| 229 | 229 | * @return IField|fields\DateTime |
| 230 | 230 | */ |
| 231 | - public function addFieldDateTime($name, $options=[]) |
|
| 231 | + public function addFieldDateTime($name, $options = []) |
|
| 232 | 232 | { |
| 233 | 233 | return $this->add($options, ['name' => $name, 'class' => 'datetime']); |
| 234 | 234 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @param array $options |
| 241 | 241 | * @return IField|fields\Integer |
| 242 | 242 | */ |
| 243 | - public function addFieldInteger($name, $options=[]) |
|
| 243 | + public function addFieldInteger($name, $options = []) |
|
| 244 | 244 | { |
| 245 | 245 | return $this->add($options, ['name' => $name, 'class' => 'integer']); |
| 246 | 246 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @param array $options |
| 253 | 253 | * @return IField|fields\Select |
| 254 | 254 | */ |
| 255 | - public function addFieldSelect($name, $options=[]) |
|
| 255 | + public function addFieldSelect($name, $options = []) |
|
| 256 | 256 | { |
| 257 | 257 | return $this->add($options, ['class' => 'select', 'name' => $name]); |
| 258 | 258 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param array $options |
| 265 | 265 | * @return IField|fields\Section |
| 266 | 266 | */ |
| 267 | - public function addFieldSection($name, $options=[]) |
|
| 267 | + public function addFieldSection($name, $options = []) |
|
| 268 | 268 | { |
| 269 | 269 | return $this->add($options, ['class' => 'section', 'name' => $name]); |
| 270 | 270 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @param array $options |
| 277 | 277 | * @return IField|fields\SwitchButton |
| 278 | 278 | */ |
| 279 | - public function addFieldSwitch($name, $options=[]) |
|
| 279 | + public function addFieldSwitch($name, $options = []) |
|
| 280 | 280 | { |
| 281 | 281 | return $this->add($options, ['class' => 'switch', 'name' => $name]); |
| 282 | 282 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | * @param array $options |
| 289 | 289 | * @return IField|fields\Textarea |
| 290 | 290 | */ |
| 291 | - public function addFieldTextArea($name, $options=[]) |
|
| 291 | + public function addFieldTextArea($name, $options = []) |
|
| 292 | 292 | { |
| 293 | 293 | return $this->add($options, ['class' => 'textarea', 'name' => $name]); |
| 294 | 294 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param array $options |
| 301 | 301 | * @return IField|fields\Time |
| 302 | 302 | */ |
| 303 | - public function addFieldTime($name, $options=[]) |
|
| 303 | + public function addFieldTime($name, $options = []) |
|
| 304 | 304 | { |
| 305 | 305 | return $this->add($options, ['name' => $name, 'class' => 'time']); |
| 306 | 306 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * @param array $options |
| 313 | 313 | * @return IField|fields\Wysiwyg |
| 314 | 314 | */ |
| 315 | - public function addFieldWysiwyg($name, $options=[]) |
|
| 315 | + public function addFieldWysiwyg($name, $options = []) |
|
| 316 | 316 | { |
| 317 | 317 | return $this->add($options, ['class' => 'wysiwyg', 'name' => $name]); |
| 318 | 318 | } |
@@ -350,14 +350,14 @@ discard block |
||
| 350 | 350 | * @throws UnknownFieldClass if the class is not found |
| 351 | 351 | * @return IField |
| 352 | 352 | */ |
| 353 | - public function makeField($field, $defaults=[]) |
|
| 353 | + public function makeField($field, $defaults = []) |
|
| 354 | 354 | { |
| 355 | 355 | if (is_array($field)) |
| 356 | 356 | $field = $this->createFieldObjectFromConfig($field, $defaults); |
| 357 | 357 | |
| 358 | 358 | if (!($field instanceof IField || $field instanceof Form)) { |
| 359 | 359 | // add this form as the parent form reference |
| 360 | - throw new \InvalidArgumentException('The $field parameter was not a valid \neon\core\form\fields\Field or \neon\core\form\Form object "' . print_r($field, true) . '" given'); |
|
| 360 | + throw new \InvalidArgumentException('The $field parameter was not a valid \neon\core\form\fields\Field or \neon\core\form\Form object "'.print_r($field, true).'" given'); |
|
| 361 | 361 | } |
| 362 | 362 | return $field; |
| 363 | 363 | } |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * @throws UnknownFieldClass |
| 382 | 382 | * @return IField |
| 383 | 383 | */ |
| 384 | - public function createFieldObjectFromConfig($config, $defaults=[]) |
|
| 384 | + public function createFieldObjectFromConfig($config, $defaults = []) |
|
| 385 | 385 | { |
| 386 | 386 | $config = Arr::merge($defaults, $config); |
| 387 | 387 | // allows class config property to be specified by an alias "switch" |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @return \neon\core\form\Form |
| 37 | 37 | * @deprecated should be using phoebe this should be replaced with using the loadFromDefinition via phoebe |
| 38 | 38 | */ |
| 39 | - public static function ddsLoadFrom($form, $classType, $includeDeleted=false) |
|
| 39 | + public static function ddsLoadFrom($form, $classType, $includeDeleted = false) |
|
| 40 | 40 | { |
| 41 | 41 | \Neon::warning('neon\core\form\Form::ddsLoadFrom is a deprecated function - phoebe is responsible for loading form definitions'); |
| 42 | 42 | $class = neon()->getDds()->getIDdsClassManagement()->getClass($classType); |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | $formDefinition = Arr::merge($formDefinition, $immutable); |
| 59 | 59 | // remove the class option |
| 60 | 60 | Arr::remove($formDefinition, 'class'); |
| 61 | - foreach($formDefinition as $key => $value) { |
|
| 61 | + foreach ($formDefinition as $key => $value) { |
|
| 62 | 62 | $form->$key = $value; |
| 63 | 63 | } |
| 64 | 64 | // Add fields to the form from the individual members |
| 65 | - if (! empty($members) ) { |
|
| 65 | + if (!empty($members)) { |
|
| 66 | 66 | foreach ($members as $member) { |
| 67 | 67 | $form->ddsAddField($member); |
| 68 | 68 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @return void |
| 79 | 79 | * @deprecated |
| 80 | 80 | */ |
| 81 | - public static function ddsSaveDefinition($form, $classType=null, $ddsMembers=null) |
|
| 81 | + public static function ddsSaveDefinition($form, $classType = null, $ddsMembers = null) |
|
| 82 | 82 | { |
| 83 | 83 | \Neon::warning('neon\core\form\Form::ddsSaveDefinition is a deprecated function - phoebe is now responsible for saving form definitions'); |
| 84 | 84 | // \neon\phoebe\builders\database\builder\Dds::saveDefinition($form); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | ]); |
| 98 | 98 | } |
| 99 | 99 | $members = $ddsClassManager->listMembers($classType, true); |
| 100 | - foreach($form->getFields() as $key => $field) { |
|
| 100 | + foreach ($form->getFields() as $key => $field) { |
|
| 101 | 101 | // set the order value to be the same as how we received them |
| 102 | 102 | $field->ddsSaveDefinition($classType, $members, $key); |
| 103 | 103 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ]); |
| 144 | 144 | // the definition might supply more information |
| 145 | 145 | $widgetDefinition = []; |
| 146 | - if (!empty($member['definition'])){ |
|
| 146 | + if (!empty($member['definition'])) { |
|
| 147 | 147 | // if the definition is already array then assume it is decoded - if it is not then assume it is a json string |
| 148 | 148 | $widgetDefinition = is_array($member['definition']) |
| 149 | 149 | ? $member['definition'] |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | // remove the value from the widget definition as this should be populated by the actual data |
| 153 | 153 | Arr::remove($widgetDefinition, 'value'); |
| 154 | - $config = Arr::merge($defaults, $widgetDefinition , $immutable); |
|
| 154 | + $config = Arr::merge($defaults, $widgetDefinition, $immutable); |
|
| 155 | 155 | |
| 156 | 156 | $form->add($config); |
| 157 | 157 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @param array|null $ddsMembers if not specified it will look up the members of the classType |
| 167 | 167 | * @deprecated |
| 168 | 168 | */ |
| 169 | - public static function ddsSaveDefinitionField($field, $classType=null, $ddsMembers=null) |
|
| 169 | + public static function ddsSaveDefinitionField($field, $classType = null, $ddsMembers = null) |
|
| 170 | 170 | { |
| 171 | 171 | \Neon::warning('neon\core\form\field::ddsSaveDefinition is a deprecated function - you should be using phoebe'); |
| 172 | 172 | $iDdsClassManagement = neon()->getDds()->getIDdsClassManagement(); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @param mixed $searchData - The request data if null should populate from the form fields internal $this->getValue() |
| 234 | 234 | * @return void |
| 235 | 235 | */ |
| 236 | - public function processAsFilter(IQuery $query, $searchData=null); |
|
| 236 | + public function processAsFilter(IQuery $query, $searchData = null); |
|
| 237 | 237 | |
| 238 | 238 | // endregion |
| 239 | 239 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @param string $delimiter - the string delimiter to separate concatenated field names by |
| 244 | 244 | * @return mixed |
| 245 | 245 | */ |
| 246 | - public function getIdPath($delimiter='.'); |
|
| 246 | + public function getIdPath($delimiter = '.'); |
|
| 247 | 247 | |
| 248 | 248 | /** |
| 249 | 249 | * Generate fake data for the field |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @param bool $required |
| 17 | 17 | * @return $this method can be chained |
| 18 | 18 | */ |
| 19 | - public function setRequired($required=true); |
|
| 19 | + public function setRequired($required = true); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Add a validator to a form field |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return $this Is a chainable function |
| 54 | 54 | */ |
| 55 | - public function addValidator($validator, $options=[]); |
|
| 55 | + public function addValidator($validator, $options = []); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @param array $validators |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | * @param bool $replace - will replace any existing attributes |
| 96 | 96 | * @return $this - chainable interface |
| 97 | 97 | */ |
| 98 | - public function setAttributes($attrs, $replace=false) |
|
| 98 | + public function setAttributes($attrs, $replace = false) |
|
| 99 | 99 | { |
| 100 | 100 | if ($replace) { |
| 101 | 101 | $this->_attributes = $attrs; |
| 102 | 102 | } else { |
| 103 | 103 | if (isset($attrs['class'])) { |
| 104 | - $this->_attributes['class'] = ' ' . $attrs['class']; |
|
| 104 | + $this->_attributes['class'] = ' '.$attrs['class']; |
|
| 105 | 105 | unset($attrs['class']); |
| 106 | 106 | } |
| 107 | 107 | $this->_attributes = array_merge($this->_attributes, $attrs); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * if a string is provided then it is used as the name property |
| 146 | 146 | * @param array $config additional configuration |
| 147 | 147 | */ |
| 148 | - public function __construct($name=[], array $config=[]) |
|
| 148 | + public function __construct($name = [], array $config = []) |
|
| 149 | 149 | { |
| 150 | 150 | // The $name field can also be a configuration array |
| 151 | 151 | if (is_array($name)) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | /** |
| 197 | 197 | * @inheritdoc |
| 198 | 198 | */ |
| 199 | - public function registerScripts($view=null, $mount=true) |
|
| 199 | + public function registerScripts($view = null, $mount = true) |
|
| 200 | 200 | { |
| 201 | 201 | $view = ($view === null) ? $this->getView() : $view; |
| 202 | 202 | FormAsset::register($view); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $field->registerScripts($view); |
| 205 | 205 | if ($this->isRootForm()) { |
| 206 | 206 | if ($mount) |
| 207 | - $view->registerJs('(new Vue()).$mount("#' . $this->id . '");', $view::POS_END, $this->id . 'vue'); |
|
| 207 | + $view->registerJs('(new Vue()).$mount("#'.$this->id.'");', $view::POS_END, $this->id.'vue'); |
|
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | public function validate($names = null, $clearErrors = true) |
| 255 | 255 | { |
| 256 | 256 | $valid = true; |
| 257 | - foreach($this->getFields($names) as $key => $field) { |
|
| 257 | + foreach ($this->getFields($names) as $key => $field) { |
|
| 258 | 258 | $valid = $field->validate() && $valid; |
| 259 | 259 | } |
| 260 | 260 | return $valid; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param array $errors |
| 301 | 301 | * @return array |
| 302 | 302 | */ |
| 303 | - protected function _getFormErrors($form, &$errors=[]) |
|
| 303 | + protected function _getFormErrors($form, &$errors = []) |
|
| 304 | 304 | { |
| 305 | 305 | foreach ($form->getFields() as $field) { |
| 306 | 306 | if ($field->isForm()) { |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | public function getErrors() |
| 326 | 326 | { |
| 327 | 327 | $errors = []; |
| 328 | - foreach($this->getFields() as $name => $field) { |
|
| 328 | + foreach ($this->getFields() as $name => $field) { |
|
| 329 | 329 | if ($field->hasError()) |
| 330 | 330 | $errors[$name] = $field->getErrors(); |
| 331 | 331 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | * @param string $error if this is not null then it is the error |
| 355 | 355 | * @return void |
| 356 | 356 | */ |
| 357 | - public function addError($fieldNameOrError='', $error=null) |
|
| 357 | + public function addError($fieldNameOrError = '', $error = null) |
|
| 358 | 358 | { |
| 359 | 359 | if ($error === null) |
| 360 | 360 | $this->_errors[] = $fieldNameOrError; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | public function getViewPath() |
| 396 | 396 | { |
| 397 | - return __DIR__ . DIRECTORY_SEPARATOR . 'views'; |
|
| 397 | + return __DIR__.DIRECTORY_SEPARATOR.'views'; |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -410,9 +410,9 @@ discard block |
||
| 410 | 410 | $i = 1; |
| 411 | 411 | while ($this->hasField($name)) { |
| 412 | 412 | if (preg_match('/.*(_[0-9]+)/', $name, $matches)) { |
| 413 | - $name = str_replace($matches[1], '_' . $i++, $name); |
|
| 413 | + $name = str_replace($matches[1], '_'.$i++, $name); |
|
| 414 | 414 | } else { |
| 415 | - $name .= '_' . $i++; |
|
| 415 | + $name .= '_'.$i++; |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | return $name; |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | * @throws InvalidCallException if a name key specified in the $names array does not exist as a field |
| 484 | 484 | * @return \neon\core\form\fields\Field[] [name => field object] |
| 485 | 485 | */ |
| 486 | - public function getFields($names=null) |
|
| 486 | + public function getFields($names = null) |
|
| 487 | 487 | { |
| 488 | 488 | $this->orderFields(); |
| 489 | 489 | if ($names === null) |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | */ |
| 517 | 517 | public function getSubForm($name) |
| 518 | 518 | { |
| 519 | - if (! $this->hasField($name)) { |
|
| 519 | + if (!$this->hasField($name)) { |
|
| 520 | 520 | throw new \Exception("No sub form exists with the name '$name'"); |
| 521 | 521 | } |
| 522 | 522 | return $this->getField($name); |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | * @throws exceptions\UnknownFieldClass - if the field class can not be created |
| 620 | 620 | * @return fields\Field |
| 621 | 621 | */ |
| 622 | - public function add($field, $defaults=[], $overwrite=false) |
|
| 622 | + public function add($field, $defaults = [], $overwrite = false) |
|
| 623 | 623 | { |
| 624 | 624 | $object = $this->makeField($field, $defaults); |
| 625 | 625 | return $this->_addField($object, $overwrite); |
@@ -632,12 +632,12 @@ discard block |
||
| 632 | 632 | * |
| 633 | 633 | * @return \neon\core\form\fields\Field |
| 634 | 634 | */ |
| 635 | - protected function _addField(IField $object, $overwrite=false) |
|
| 635 | + protected function _addField(IField $object, $overwrite = false) |
|
| 636 | 636 | { |
| 637 | 637 | // pass the field a reference to its parent form |
| 638 | 638 | $object->setForm($this); |
| 639 | 639 | if ($object->getName() == '') { |
| 640 | - throw new \InvalidArgumentException('A field object must have a name set before adding it to the form. You tried to add ' . print_r($object->toArray(), true)); |
|
| 640 | + throw new \InvalidArgumentException('A field object must have a name set before adding it to the form. You tried to add '.print_r($object->toArray(), true)); |
|
| 641 | 641 | } |
| 642 | 642 | if ($object instanceof Field || $object instanceof Form) { |
| 643 | 643 | // the field object seems to be valid so before we add it we just check this is not a conflict with an existing field |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | // add this form as the parent form reference |
| 649 | 649 | $this->_fields[$object->getName()] = $object; |
| 650 | 650 | } else { |
| 651 | - throw new \InvalidArgumentException('The $object parameter was not a valid \neon\core\form\Field or \neon\core\form\Form object "' . print_r($object, true) . '" given'); |
|
| 651 | + throw new \InvalidArgumentException('The $object parameter was not a valid \neon\core\form\Field or \neon\core\form\Form object "'.print_r($object, true).'" given'); |
|
| 652 | 652 | } |
| 653 | 653 | return $object; |
| 654 | 654 | } |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | */ |
| 677 | 677 | public function renderCsrfField() |
| 678 | 678 | { |
| 679 | - return '<input type="hidden" name="'.$this->getRequest()->csrfParam.'" value="' . $this->getRequest()->getCsrfToken() . '" />'; |
|
| 679 | + return '<input type="hidden" name="'.$this->getRequest()->csrfParam.'" value="'.$this->getRequest()->getCsrfToken().'" />'; |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /** |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | * @throws \yii\base\InvalidConfigException getBodyParams may throw this error if a registered parser does not implement the [[RequestParserInterface]]. |
| 749 | 749 | * @return array the request data |
| 750 | 750 | */ |
| 751 | - public function getRawRequestData($key=null) |
|
| 751 | + public function getRawRequestData($key = null) |
|
| 752 | 752 | { |
| 753 | 753 | $params = $this->getRequest()->getBodyParams(); |
| 754 | 754 | $data = isset($params[$this->getName()]) ? $params[$this->getName()] : []; |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | * @throws \Exception - if request object is configured incorrectly |
| 780 | 780 | * @return $this |
| 781 | 781 | */ |
| 782 | - public function load($data=[]) |
|
| 782 | + public function load($data = []) |
|
| 783 | 783 | { |
| 784 | 784 | if (empty($data) && $this->hasRequestData()) { |
| 785 | 785 | $data = $this->getRawRequestData(); |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | * Root forms always require an id |
| 872 | 872 | * @return String |
| 873 | 873 | */ |
| 874 | - public function getId($autoGenerate=false) |
|
| 874 | + public function getId($autoGenerate = false) |
|
| 875 | 875 | { |
| 876 | 876 | if ($this->_id) |
| 877 | 877 | return $this->_id; |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | * @inheritdoc - IField implementation, |
| 993 | 993 | * Possibly applicable to the form - perhaps if set the form will complain unless all its children are set?? |
| 994 | 994 | */ |
| 995 | - public function setRequired($required=true) |
|
| 995 | + public function setRequired($required = true) |
|
| 996 | 996 | {} |
| 997 | 997 | // endregion |
| 998 | 998 | |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | public function getProperties() |
| 1066 | 1066 | { |
| 1067 | 1067 | $props = [ |
| 1068 | - 'class', 'id', 'name', 'enableAjaxValidation','enableAjaxSubmission', |
|
| 1068 | + 'class', 'id', 'name', 'enableAjaxValidation', 'enableAjaxSubmission', |
|
| 1069 | 1069 | 'label', 'hint', 'inline', 'visible', 'order', 'action', 'readOnly', 'printOnly', 'validationUrl', |
| 1070 | 1070 | 'attributes', 'fields', 'objectToken' |
| 1071 | 1071 | ]; |
@@ -1201,10 +1201,10 @@ discard block |
||
| 1201 | 1201 | * |
| 1202 | 1202 | * @return Form |
| 1203 | 1203 | */ |
| 1204 | - public function getFilterForm($config=[]) |
|
| 1204 | + public function getFilterForm($config = []) |
|
| 1205 | 1205 | { |
| 1206 | 1206 | $searchForm = new Form($config); |
| 1207 | - foreach($this->getFields() as $field) { |
|
| 1207 | + foreach ($this->getFields() as $field) { |
|
| 1208 | 1208 | $filterField = $field->getFilterField(); |
| 1209 | 1209 | |
| 1210 | 1210 | if ($filterField !== false) { |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | public function processAsFilter(IQuery $query, $searchData = null) |
| 1229 | 1229 | { |
| 1230 | 1230 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
| 1231 | - foreach($this->getFields() as $key => $field) { |
|
| 1231 | + foreach ($this->getFields() as $key => $field) { |
|
| 1232 | 1232 | if (isset($searchData[$key])) { |
| 1233 | 1233 | $field->processAsFilter($query, $searchData[$key]); |
| 1234 | 1234 | } |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | */ |
| 1269 | 1269 | public function reset() |
| 1270 | 1270 | { |
| 1271 | - foreach($this->getFields() as $field) |
|
| 1271 | + foreach ($this->getFields() as $field) |
|
| 1272 | 1272 | $field->reset(); |
| 1273 | 1273 | } |
| 1274 | 1274 | |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | public function fake() |
| 1288 | 1288 | { |
| 1289 | 1289 | $fake = []; |
| 1290 | - foreach($this->getFields() as $key => $field) { |
|
| 1290 | + foreach ($this->getFields() as $key => $field) { |
|
| 1291 | 1291 | $val = $field->fake(); |
| 1292 | 1292 | if (empty($val)) continue; |
| 1293 | 1293 | $fake[$key] = $val; |
@@ -1299,7 +1299,7 @@ discard block |
||
| 1299 | 1299 | * @deprecated should be using phoebe this should be replaced with using the loadFromDefinition via phoebe |
| 1300 | 1300 | * @see Deprecated::ddsLoadFrom |
| 1301 | 1301 | */ |
| 1302 | - public function ddsLoadFrom($classType, $includeDeleted=false) |
|
| 1302 | + public function ddsLoadFrom($classType, $includeDeleted = false) |
|
| 1303 | 1303 | { |
| 1304 | 1304 | return Deprecated::ddsLoadFrom($this, $classType, $includeDeleted); |
| 1305 | 1305 | } |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | * @deprecated - should be using phoebe |
| 1309 | 1309 | * @see Deprecated::ddsSaveDefinition |
| 1310 | 1310 | */ |
| 1311 | - public function ddsSaveDefinition($classType=null, $ddsMembers=null) |
|
| 1311 | + public function ddsSaveDefinition($classType = null, $ddsMembers = null) |
|
| 1312 | 1312 | { |
| 1313 | 1313 | Deprecated::ddsSaveDefinition($this, $classType, $ddsMembers); |
| 1314 | 1314 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function init() |
| 32 | 32 | { |
| 33 | - $this->sourcePath = __DIR__ . '/vendor/ckeditor'; |
|
| 33 | + $this->sourcePath = __DIR__.'/vendor/ckeditor'; |
|
| 34 | 34 | parent::init(); |
| 35 | 35 | } |
| 36 | 36 | } |