@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | // process the parameters |
147 | 147 | if (!isset($params['classType'])) |
148 | - throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params,true)); |
|
148 | + throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params, true)); |
|
149 | 149 | $classType = $params['classType']; |
150 | 150 | $label = isset($params['label']) ? $params['label'] : null; |
151 | 151 | $id = !empty($params['id']) ? $params['id'] : null; |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | $assignSaved = !empty($params['assignSaved']) ? $params['assignSaved'] : 'saved'; |
157 | 157 | $assignErrors = !empty($params['assignErrors']) ? $params['assignErrors'] : 'errors'; |
158 | 158 | $assignSubmitted = !empty($params['assignSubmitted']) ? $params['assignSubmitted'] : 'submitted'; |
159 | - $readOnly = isset($params['readOnly']) ? (bool)$params['readOnly'] : false; |
|
160 | - $printOnly = isset($params['printOnly']) ? (bool)$params['printOnly'] : false; |
|
159 | + $readOnly = isset($params['readOnly']) ? (bool) $params['readOnly'] : false; |
|
160 | + $printOnly = isset($params['printOnly']) ? (bool) $params['printOnly'] : false; |
|
161 | 161 | $uuid = !empty($params['uuid']) ? $params['uuid'] : null; |
162 | 162 | $dataSources = !empty($params['dataSources']) ? $params['dataSources'] : null; |
163 | - $enableAjaxValidation = isset($params['enableAjaxValidation']) ? (bool)$params['enableAjaxValidation'] : true; |
|
164 | - $enableAjaxSubmission = isset($params['enableAjaxSubmission']) ? (bool)$params['enableAjaxSubmission'] : false; |
|
163 | + $enableAjaxValidation = isset($params['enableAjaxValidation']) ? (bool) $params['enableAjaxValidation'] : true; |
|
164 | + $enableAjaxSubmission = isset($params['enableAjaxSubmission']) ? (bool) $params['enableAjaxSubmission'] : false; |
|
165 | 165 | $ajaxValidationUrl = !empty($params['ajaxValidationUrl']) ? $params['ajaxValidationUrl'] : '/phoebe/database/index/validate-form'; |
166 | 166 | $returnUrl = !empty($params['returnUrl']) ? $params['returnUrl'] : null; |
167 | 167 | $formName = !empty($params['name']) ? $params['name'] : null; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $id = ($id ? $id : ($uuid ? $uuid : null)); |
175 | 175 | if ($id) { |
176 | 176 | if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_') |
177 | - $id = 'z' . $id; |
|
177 | + $id = 'z'.$id; |
|
178 | 178 | } |
179 | 179 | $changeLogUuids = []; |
180 | 180 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | // assign all of the save results to the template |
246 | 246 | foreach ($saveFormResults as $k=>$v) |
247 | - $template->assign($k,$v); |
|
247 | + $template->assign($k, $v); |
|
248 | 248 | |
249 | 249 | |
250 | 250 | // assign the resulting form |
@@ -144,8 +144,9 @@ discard block |
||
144 | 144 | $phoebeType = 'daedalus'; |
145 | 145 | |
146 | 146 | // process the parameters |
147 | - if (!isset($params['classType'])) |
|
148 | - throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params,true)); |
|
147 | + if (!isset($params['classType'])) { |
|
148 | + throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params,true)); |
|
149 | + } |
|
149 | 150 | $classType = $params['classType']; |
150 | 151 | $label = isset($params['label']) ? $params['label'] : null; |
151 | 152 | $id = !empty($params['id']) ? $params['id'] : null; |
@@ -173,8 +174,9 @@ discard block |
||
173 | 174 | // prefix invalid (HTML5) ids with a letter |
174 | 175 | $id = ($id ? $id : ($uuid ? $uuid : null)); |
175 | 176 | if ($id) { |
176 | - if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_') |
|
177 | - $id = 'z' . $id; |
|
177 | + if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_') { |
|
178 | + $id = 'z' . $id; |
|
179 | + } |
|
178 | 180 | } |
179 | 181 | $changeLogUuids = []; |
180 | 182 | |
@@ -243,8 +245,9 @@ discard block |
||
243 | 245 | } |
244 | 246 | |
245 | 247 | // assign all of the save results to the template |
246 | - foreach ($saveFormResults as $k=>$v) |
|
247 | - $template->assign($k,$v); |
|
248 | + foreach ($saveFormResults as $k=>$v) { |
|
249 | + $template->assign($k,$v); |
|
250 | + } |
|
248 | 251 | |
249 | 252 | |
250 | 253 | // assign the resulting form |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * Start the appForm Builder for this class |
63 | 63 | * @param string $type the class type of the object required |
64 | 64 | */ |
65 | - public function actionEdit($type=null) |
|
65 | + public function actionEdit($type = null) |
|
66 | 66 | { |
67 | 67 | if (!$this->canDevelop()) |
68 | 68 | throw new \HttpException(403, 'This operation is not permitted here'); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $grid = new \neon\core\grid\PhoebeGrid([ |
123 | 123 | 'phoebeType'=>$this->phoebeType, |
124 | 124 | 'classType'=>$type, |
125 | - 'additionalColumns' => ['data','deleted'] |
|
125 | + 'additionalColumns' => ['data', 'deleted'] |
|
126 | 126 | ]); |
127 | 127 | return $this->render('list', [ |
128 | 128 | 'grid' => $grid, |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param string $type the applicationForm class type the object belongs to |
138 | 138 | * @param string $id the Object id |
139 | 139 | */ |
140 | - public function actionDeleteObject($type, $id, $redirect=true) |
|
140 | + public function actionDeleteObject($type, $id, $redirect = true) |
|
141 | 141 | { |
142 | 142 | $this->deleteObject($id); |
143 | 143 | if ($redirect) |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param type $classType |
151 | 151 | * @return type |
152 | 152 | */ |
153 | - public function actionValidateForm($classType, $name=null) |
|
153 | + public function actionValidateForm($classType, $name = null) |
|
154 | 154 | { |
155 | 155 | return PhoebeValidator::validateForm('applicationForm', $classType, $name); |
156 | 156 | } |
@@ -64,8 +64,9 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function actionEdit($type=null) |
66 | 66 | { |
67 | - if (!$this->canDevelop()) |
|
68 | - throw new \HttpException(403, 'This operation is not permitted here'); |
|
67 | + if (!$this->canDevelop()) { |
|
68 | + throw new \HttpException(403, 'This operation is not permitted here'); |
|
69 | + } |
|
69 | 70 | |
70 | 71 | $builderDefinition = $this->getBuilderDefinition($type); |
71 | 72 | $isNew = ($type === null || count($builderDefinition) == 0); |
@@ -140,8 +141,9 @@ discard block |
||
140 | 141 | public function actionDeleteObject($type, $id, $redirect=true) |
141 | 142 | { |
142 | 143 | $this->deleteObject($id); |
143 | - if ($redirect) |
|
144 | - $this->redirect([$this->baseUrl.'list-objects', 'type' => $type]); |
|
144 | + if ($redirect) { |
|
145 | + $this->redirect([$this->baseUrl.'list-objects', 'type' => $type]); |
|
146 | + } |
|
145 | 147 | return ''; |
146 | 148 | } |
147 | 149 | |
@@ -188,11 +190,13 @@ discard block |
||
188 | 190 | public function actionEditObject($type, $id) |
189 | 191 | { |
190 | 192 | $form = $this->getPhoebeForm($type); |
191 | - if (neon()->request->getIsAjax()) |
|
192 | - return $form->ajaxValidation(); |
|
193 | + if (neon()->request->getIsAjax()) { |
|
194 | + return $form->ajaxValidation(); |
|
195 | + } |
|
193 | 196 | $object = $this->getObject($id); |
194 | - if (!$object) |
|
195 | - throw new NotFoundHttpException('The requested form was not found'); |
|
197 | + if (!$object) { |
|
198 | + throw new NotFoundHttpException('The requested form was not found'); |
|
199 | + } |
|
196 | 200 | if ($form->processRequest()) { |
197 | 201 | $object->editObject($form->getData()); |
198 | 202 | $this->redirect([$this->baseUrl.'list-objects', 'type'=>$type]); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | // temporary hack to sort out uuids being passed in rather than |
42 | 42 | // a human readable definition. |
43 | 43 | if ($this->is_uuid($class)) |
44 | - $class=str_replace(['-','_'], ['a','Z'],Hash::uuid2uuid64($class)); |
|
44 | + $class = str_replace(['-', '_'], ['a', 'Z'], Hash::uuid2uuid64($class)); |
|
45 | 45 | else |
46 | 46 | $class = $phoebe->canonicaliseRef($class); |
47 | 47 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | // close the migration |
66 | 66 | $this->endMigration(); |
67 | 67 | |
68 | - $phoebeClass = $phoebe->getClass($class); |
|
68 | + $phoebeClass = $phoebe->getClass($class); |
|
69 | 69 | if ($phoebeClass == null) { |
70 | 70 | $phoebeClass = ['error' => "No class exists with a type of '$class'"]; |
71 | 71 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | private function is_uuid($str) |
83 | 83 | { |
84 | - return (strlen($str)==36 && substr_count($str, '-')==4); |
|
84 | + return (strlen($str) == 36 && substr_count($str, '-') == 4); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -40,10 +40,11 @@ discard block |
||
40 | 40 | |
41 | 41 | // temporary hack to sort out uuids being passed in rather than |
42 | 42 | // a human readable definition. |
43 | - if ($this->is_uuid($class)) |
|
44 | - $class=str_replace(['-','_'], ['a','Z'],Hash::uuid2uuid64($class)); |
|
45 | - else |
|
46 | - $class = $phoebe->canonicaliseRef($class); |
|
43 | + if ($this->is_uuid($class)) { |
|
44 | + $class=str_replace(['-','_'], ['a','Z'],Hash::uuid2uuid64($class)); |
|
45 | + } else { |
|
46 | + $class = $phoebe->canonicaliseRef($class); |
|
47 | + } |
|
47 | 48 | |
48 | 49 | $definition = neon()->request->getBodyParams(); |
49 | 50 | if (!isset($definition['name'])) { |
@@ -55,8 +56,9 @@ discard block |
||
55 | 56 | |
56 | 57 | // save the class information |
57 | 58 | $phoebeClass = $phoebe->getClass($class); |
58 | - if (!$phoebeClass) |
|
59 | - $phoebeClass = $phoebe->addClass($class, 'phoebe'); |
|
59 | + if (!$phoebeClass) { |
|
60 | + $phoebeClass = $phoebe->addClass($class, 'phoebe'); |
|
61 | + } |
|
60 | 62 | $phoebeClass->editClass([ |
61 | 63 | 'definition' => $definition, |
62 | 64 | 'label' => $definition['name'] |
@@ -52,7 +52,7 @@ |
||
52 | 52 | * @param string $type the phoebe class type |
53 | 53 | * @return \neon\core\form\Form |
54 | 54 | */ |
55 | - protected function getPhoebeForm($type, &$isNewForm=null, $addExtras=true, $builder=false) |
|
55 | + protected function getPhoebeForm($type, &$isNewForm = null, $addExtras = true, $builder = false) |
|
56 | 56 | { |
57 | 57 | $form = null; |
58 | 58 | $isNewForm = false; |
@@ -61,8 +61,9 @@ discard block |
||
61 | 61 | $class = $this->getClass($type); |
62 | 62 | if ($builder) { |
63 | 63 | $definition = $class->getClassBuilderDefinition(); |
64 | - } else |
|
65 | - $definition = $class->getClassFormDefinition(); |
|
64 | + } else { |
|
65 | + $definition = $class->getClassFormDefinition(); |
|
66 | + } |
|
66 | 67 | $fieldCount = count($definition['fields']); |
67 | 68 | $isNewForm = count($definition) == 0 ? true : false; |
68 | 69 | $form = new \neon\core\form\Form($definition); |
@@ -114,8 +115,9 @@ discard block |
||
114 | 115 | protected function getBuilderDefinition($classType) |
115 | 116 | { |
116 | 117 | $class = null; |
117 | - if ($classType) |
|
118 | - $class = $this->getClass($classType); |
|
118 | + if ($classType) { |
|
119 | + $class = $this->getClass($classType); |
|
120 | + } |
|
119 | 121 | return $class ? $class->getClassBuilderDefinition() : []; |
120 | 122 | } |
121 | 123 | |
@@ -127,8 +129,9 @@ discard block |
||
127 | 129 | protected function getClassDefinition($classType) |
128 | 130 | { |
129 | 131 | $class = null; |
130 | - if ($classType) |
|
131 | - $class = $this->getClass($classType); |
|
132 | + if ($classType) { |
|
133 | + $class = $this->getClass($classType); |
|
134 | + } |
|
132 | 135 | return $class ? $class->definition : []; |
133 | 136 | } |
134 | 137 | |
@@ -151,8 +154,9 @@ discard block |
||
151 | 154 | protected function getObject($id) |
152 | 155 | { |
153 | 156 | $object = $this->phoebe()->getObject($id); |
154 | - if (!$object) |
|
155 | - throw new \yii\web\HttpException(404); |
|
157 | + if (!$object) { |
|
158 | + throw new \yii\web\HttpException(404); |
|
159 | + } |
|
156 | 160 | return $object; |
157 | 161 | } |
158 | 162 | |
@@ -164,8 +168,9 @@ discard block |
||
164 | 168 | protected function deleteObject($id) |
165 | 169 | { |
166 | 170 | $object = $this->phoebe()->getObject($id); |
167 | - if ($object) |
|
168 | - return $object->deleteObject(); |
|
171 | + if ($object) { |
|
172 | + return $object->deleteObject(); |
|
173 | + } |
|
169 | 174 | return null; |
170 | 175 | } |
171 | 176 | |
@@ -177,8 +182,9 @@ discard block |
||
177 | 182 | protected function undeleteObject($id) |
178 | 183 | { |
179 | 184 | $object = $this->phoebe()->getObject($id); |
180 | - if ($object) |
|
181 | - return $object->undeleteObject(); |
|
185 | + if ($object) { |
|
186 | + return $object->undeleteObject(); |
|
187 | + } |
|
182 | 188 | return null; |
183 | 189 | } |
184 | 190 | |
@@ -190,8 +196,9 @@ discard block |
||
190 | 196 | protected function destroyObject($id) |
191 | 197 | { |
192 | 198 | $object = $this->phoebe()->getObject($id); |
193 | - if ($object) |
|
194 | - return $object->destroyObject(); |
|
199 | + if ($object) { |
|
200 | + return $object->destroyObject(); |
|
201 | + } |
|
195 | 202 | return null; |
196 | 203 | } |
197 | 204 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | */ |
8 | 8 | class PhoebeValidator |
9 | 9 | { |
10 | - public static function validateForm($phoebeType, $classType, $name=null) |
|
10 | + public static function validateForm($phoebeType, $classType, $name = null) |
|
11 | 11 | { |
12 | 12 | // get hold of the form |
13 | 13 | $form = neon('phoebe')->getForm($phoebeType, $classType, []); |
@@ -11,8 +11,9 @@ |
||
11 | 11 | { |
12 | 12 | // get hold of the form |
13 | 13 | $form = neon('phoebe')->getForm($phoebeType, $classType, []); |
14 | - if ($name) |
|
15 | - $form->setName($name); |
|
14 | + if ($name) { |
|
15 | + $form->setName($name); |
|
16 | + } |
|
16 | 17 | return $form->ajaxValidation(); |
17 | 18 | } |
18 | 19 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | class FormBuilderAsset extends \yii\web\AssetBundle |
14 | 14 | { |
15 | - public $sourcePath = __DIR__ . '/publish'; |
|
15 | + public $sourcePath = __DIR__.'/publish'; |
|
16 | 16 | |
17 | 17 | public $js = [ |
18 | 18 | 'store.js', |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | class AppFormBuilderAsset extends \yii\web\AssetBundle |
15 | 15 | { |
16 | - public $sourcePath = __DIR__ . '/publish'; |
|
16 | + public $sourcePath = __DIR__.'/publish'; |
|
17 | 17 | |
18 | 18 | public $js = [ |
19 | 19 | 'manifest.js', |
@@ -7,11 +7,11 @@ |
||
7 | 7 | */ |
8 | 8 | class m171011_143735_forms_phoebe extends Migration |
9 | 9 | { |
10 | - public function safeUp() |
|
11 | - { |
|
12 | - } |
|
10 | + public function safeUp() |
|
11 | + { |
|
12 | + } |
|
13 | 13 | |
14 | - public function safeDown() |
|
15 | - { |
|
16 | - } |
|
14 | + public function safeDown() |
|
15 | + { |
|
16 | + } |
|
17 | 17 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * @inheritdoc |
93 | 93 | */ |
94 | - public function getDataMap($key, $query='', $filters=[], $fields=[], $start=0, $length=100) |
|
94 | + public function getDataMap($key, $query = '', $filters = [], $fields = [], $start = 0, $length = 100) |
|
95 | 95 | { |
96 | 96 | // convert generic form builder filters to phoebe class ones |
97 | 97 | $filters = Arr::replaceKeys($filters, ['uuid'=> 'class_type']); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * that you want to display and in what order |
174 | 174 | * @return array |
175 | 175 | */ |
176 | - public function getFormDefinition($phoebeType, $classType, array $fields=[]) |
|
176 | + public function getFormDefinition($phoebeType, $classType, array $fields = []) |
|
177 | 177 | { |
178 | 178 | $cacheKey = md5(serialize(func_get_args())); |
179 | 179 | return neon()->cacheArray->getOrSet($cacheKey, function() use ($classType, $phoebeType, $fields) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * @return bool - returns true if saved correctly or the set of errors if the |
427 | 427 | * form couldn't validate |
428 | 428 | */ |
429 | - public function saveForm($phoebeType, $classType, $form=null, $formName=null, $metaInfo=null, &$uuid=null, &$changeLogUuids=[]) |
|
429 | + public function saveForm($phoebeType, $classType, $form = null, $formName = null, $metaInfo = null, &$uuid = null, &$changeLogUuids = []) |
|
430 | 430 | { |
431 | 431 | $changeLogUuids = []; |
432 | 432 | if (!$form) { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | $itemKey = substr($key, strlen($this->formMetaDataSourceString)); |
510 | 510 | if (empty($meta['dataSources'][$itemKey])) |
511 | 511 | $meta['dataSources'][$itemKey] = $v; |
512 | - } else if ($key==$this->formMetaReturnUrlString && empty($meta['returnUrl'])) { |
|
512 | + } else if ($key == $this->formMetaReturnUrlString && empty($meta['returnUrl'])) { |
|
513 | 513 | $meta['returnUrl'] = $v; |
514 | 514 | } |
515 | 515 | } |
@@ -251,16 +251,18 @@ discard block |
||
251 | 251 | $formDefinition = []; |
252 | 252 | if (!empty($options['uuid'])) { |
253 | 253 | $object = $phoebe->getObject($options['uuid']); |
254 | - if (!$object) |
|
255 | - throw new \RuntimeException('The requested form object was not found. Uuid='.$options['uuid']); |
|
254 | + if (!$object) { |
|
255 | + throw new \RuntimeException('The requested form object was not found. Uuid='.$options['uuid']); |
|
256 | + } |
|
256 | 257 | $class = $object->getIPhoebeClass(); |
257 | 258 | $formDefinition = $class->getClassFormDefinition($fields); |
258 | 259 | } else { |
259 | 260 | // otherwise get a clean class |
260 | 261 | if ($classType) { |
261 | 262 | $formDefinition = $this->getFormDefinition($phoebeType, $classType, $fields); |
262 | - if (!count($formDefinition)) |
|
263 | - throw new \RuntimeException('The requested form type was not found. Type='.$classType); |
|
263 | + if (!count($formDefinition)) { |
|
264 | + throw new \RuntimeException('The requested form type was not found. Type='.$classType); |
|
265 | + } |
|
264 | 266 | } |
265 | 267 | } |
266 | 268 | $fieldCount = count($formDefinition['fields']); |
@@ -268,12 +270,14 @@ discard block |
||
268 | 270 | |
269 | 271 | |
270 | 272 | // temporary code to cover problems with differences between appForms and ddsForms |
271 | - if ($phoebeType !== 'applicationForm' && !empty($options['initialiseFromDds'])) |
|
272 | - throw new \RuntimeException('Only applicationForms work with initialiseFromDds'); |
|
273 | + if ($phoebeType !== 'applicationForm' && !empty($options['initialiseFromDds'])) { |
|
274 | + throw new \RuntimeException('Only applicationForms work with initialiseFromDds'); |
|
275 | + } |
|
273 | 276 | |
274 | 277 | // set the form id |
275 | - if (!empty($options['id'])) |
|
276 | - $form->setId($options['id']); |
|
278 | + if (!empty($options['id'])) { |
|
279 | + $form->setId($options['id']); |
|
280 | + } |
|
277 | 281 | $formId = $form->getId(); |
278 | 282 | if ($printOnly) { |
279 | 283 | $form->printOnly = true; |
@@ -284,17 +288,20 @@ discard block |
||
284 | 288 | } |
285 | 289 | |
286 | 290 | // set the forms label - allow clearing of it via empty string |
287 | - if (isset($options['label'])) |
|
288 | - $form->setLabel($options['label']); |
|
291 | + if (isset($options['label'])) { |
|
292 | + $form->setLabel($options['label']); |
|
293 | + } |
|
289 | 294 | |
290 | 295 | |
291 | 296 | // check to see if we are not posting from the client, populate it from the database |
292 | 297 | // !set the form name before checking data set! |
293 | - if (!empty($options['name'])) |
|
294 | - $form->setName($options['name']); |
|
298 | + if (!empty($options['name'])) { |
|
299 | + $form->setName($options['name']); |
|
300 | + } |
|
295 | 301 | if (!empty($options['initialiseFromDds']) && (!$object || !$object->data)) { |
296 | - if (!$object) |
|
297 | - $object = $phoebe->createStubObject($classType); |
|
302 | + if (!$object) { |
|
303 | + $object = $phoebe->createStubObject($classType); |
|
304 | + } |
|
298 | 305 | $object->initialiseFromDds($options['initialiseFromDds']); |
299 | 306 | } |
300 | 307 | if ($object && !$form->hasRequestData()) { |
@@ -302,8 +309,9 @@ discard block |
||
302 | 309 | } |
303 | 310 | |
304 | 311 | if (!($printOnly || $readOnly)) { |
305 | - if (!empty($options['uuid'])) |
|
306 | - $form->addFieldHidden("{$this->formMetaPrefix}{$this->formMetaUuidString}", ['value'=>$options['uuid']]); |
|
312 | + if (!empty($options['uuid'])) { |
|
313 | + $form->addFieldHidden("{$this->formMetaPrefix}{$this->formMetaUuidString}", ['value'=>$options['uuid']]); |
|
314 | + } |
|
307 | 315 | |
308 | 316 | // set any additional data sources |
309 | 317 | if (!empty($options['dataSources'])) { |
@@ -311,8 +319,9 @@ discard block |
||
311 | 319 | $form->addFieldHidden("{$this->formMetaPrefix}{$this->formMetaDataSourceString}$key", ['value'=>$value]); |
312 | 320 | // for dds forms, set the values on the form too for initial display |
313 | 321 | if ($phoebeType == 'daedalus') { |
314 | - if ($form->hasField($key)) |
|
315 | - $form->getField($key)->setValue($value); |
|
322 | + if ($form->hasField($key)) { |
|
323 | + $form->getField($key)->setValue($value); |
|
324 | + } |
|
316 | 325 | } |
317 | 326 | } |
318 | 327 | } |
@@ -323,8 +332,9 @@ discard block |
||
323 | 332 | if (!empty($options['mapFilters'])) { |
324 | 333 | foreach ($options['mapFilters'] as $key=>$filters) { |
325 | 334 | $f = $form->getField($key); |
326 | - if ($f && isset($f->dataMapFilters)) |
|
327 | - $f->dataMapFilters = $filters; |
|
335 | + if ($f && isset($f->dataMapFilters)) { |
|
336 | + $f->dataMapFilters = $filters; |
|
337 | + } |
|
328 | 338 | } |
329 | 339 | } |
330 | 340 | |
@@ -334,8 +344,9 @@ discard block |
||
334 | 344 | if (!empty($options['mapFields'])) { |
335 | 345 | foreach ($options['mapFields'] as $key=>$mapFields) { |
336 | 346 | $f = $form->getField($key); |
337 | - if ($f && isset($f->dataMapFields)) |
|
338 | - $f->dataMapFields = $mapFields; |
|
347 | + if ($f && isset($f->dataMapFields)) { |
|
348 | + $f->dataMapFields = $mapFields; |
|
349 | + } |
|
339 | 350 | } |
340 | 351 | } |
341 | 352 | |
@@ -360,20 +371,24 @@ discard block |
||
360 | 371 | } |
361 | 372 | |
362 | 373 | // set the forms action |
363 | - if (!empty($options['action'])) |
|
364 | - $form->setAction($options['action']); |
|
374 | + if (!empty($options['action'])) { |
|
375 | + $form->setAction($options['action']); |
|
376 | + } |
|
365 | 377 | |
366 | 378 | // set whether or not ajax validation is required |
367 | - if (isset($options['enableAjaxValidation'])) |
|
368 | - $form->enableAjaxValidation = (boolean) $options['enableAjaxValidation']; |
|
379 | + if (isset($options['enableAjaxValidation'])) { |
|
380 | + $form->enableAjaxValidation = (boolean) $options['enableAjaxValidation']; |
|
381 | + } |
|
369 | 382 | |
370 | 383 | // set whether or not ajax submission is required |
371 | - if (isset($options['enableAjaxSubmission'])) |
|
372 | - $form->enableAjaxSubmission = (boolean) $options['enableAjaxSubmission']; |
|
384 | + if (isset($options['enableAjaxSubmission'])) { |
|
385 | + $form->enableAjaxSubmission = (boolean) $options['enableAjaxSubmission']; |
|
386 | + } |
|
373 | 387 | |
374 | 388 | // set where the form will check itself via ajaxValidation |
375 | - if (!empty($options['ajaxValidationUrl'])) |
|
376 | - $form->validationUrl = $options['ajaxValidationUrl']; |
|
389 | + if (!empty($options['ajaxValidationUrl'])) { |
|
390 | + $form->validationUrl = $options['ajaxValidationUrl']; |
|
391 | + } |
|
377 | 392 | |
378 | 393 | // set where the browser will go to after completion of the form |
379 | 394 | if (!empty($options['returnUrl'])) { |
@@ -433,8 +448,9 @@ discard block |
||
433 | 448 | $definition = $this->getFormDefinition($phoebeType, $classType); |
434 | 449 | $form = new \neon\core\form\Form($definition); |
435 | 450 | } |
436 | - if (!empty($formName)) |
|
437 | - $form->setName($formName); |
|
451 | + if (!empty($formName)) { |
|
452 | + $form->setName($formName); |
|
453 | + } |
|
438 | 454 | if ($form->processRequest()) { |
439 | 455 | $data = $form->getData(); |
440 | 456 | // prevent multiple renders resulting in multiple saves of the form |
@@ -456,13 +472,15 @@ discard block |
||
456 | 472 | $changeLogUuids['add'] = $object->getChangeLogUuid(); |
457 | 473 | } |
458 | 474 | $uuid = $object->uuid; |
459 | - if (!empty($meta['dataSources'])) |
|
460 | - $object->setDataSources($meta['dataSources']); |
|
475 | + if (!empty($meta['dataSources'])) { |
|
476 | + $object->setDataSources($meta['dataSources']); |
|
477 | + } |
|
461 | 478 | if ($object->editObject($data) === true) { |
462 | 479 | $alreadySubmitted[$submittedCheck] = $uuid; |
463 | 480 | $changeLogUuids['edit'] = $object->getChangeLogUuid(); |
464 | - if (!empty($meta['returnUrl'])) |
|
465 | - neon()->response->redirect(html_entity_decode($meta['returnUrl'])); |
|
481 | + if (!empty($meta['returnUrl'])) { |
|
482 | + neon()->response->redirect(html_entity_decode($meta['returnUrl'])); |
|
483 | + } |
|
466 | 484 | return true; |
467 | 485 | } |
468 | 486 | } else { |
@@ -507,8 +525,9 @@ discard block |
||
507 | 525 | $meta['uuid'] = $v; |
508 | 526 | } else if (strpos($key, $this->formMetaDataSourceString) === 0) { |
509 | 527 | $itemKey = substr($key, strlen($this->formMetaDataSourceString)); |
510 | - if (empty($meta['dataSources'][$itemKey])) |
|
511 | - $meta['dataSources'][$itemKey] = $v; |
|
528 | + if (empty($meta['dataSources'][$itemKey])) { |
|
529 | + $meta['dataSources'][$itemKey] = $v; |
|
530 | + } |
|
512 | 531 | } else if ($key==$this->formMetaReturnUrlString && empty($meta['returnUrl'])) { |
513 | 532 | $meta['returnUrl'] = $v; |
514 | 533 | } |