From 7d5b321a64cecb4281ec67035251583df1f1c3fb Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 2 Jun 2021 21:08:22 +0300 Subject: [PATCH] feat(form): use `_self` instead of `__self` #25 --- app/Models/Form.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Models/Form.php b/app/Models/Form.php index df2e29f..3e534cc 100644 --- a/app/Models/Form.php +++ b/app/Models/Form.php @@ -106,21 +106,21 @@ public function getFields(): array switch ($field['type']) { case 'bool': if (isset($field['value'])) { - $data[$field['name']] = strings(flextype('twig')->fetchFromString(strings($field['value'])->replace('__self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []))->toBoolean(); + $data[$field['name']] = strings(flextype('twig')->fetchFromString(strings($field['value'])->replace('_self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []))->toBoolean(); } else { $data[$field['name']] = strings(arrays($this->data)->get($field['name']))->toBoolean(); } break; case 'float': if (isset($field['value'])) { - $data[$field['name']] = strings(flextype('twig')->fetchFromString(strings($field['value'])->replace('__self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []))->toFloat(); + $data[$field['name']] = strings(flextype('twig')->fetchFromString(strings($field['value'])->replace('_self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []))->toFloat(); } else { $data[$field['name']] = strings(arrays($this->data)->get($field['name']))->toFloat(); } break; case 'int': if (isset($field['value'])) { - $data[$field['name']] = strings(flextype('twig')->fetchFromString(strings($field['value'])->replace('__self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []))->toInteger(); + $data[$field['name']] = strings(flextype('twig')->fetchFromString(strings($field['value'])->replace('_self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []))->toInteger(); } else { $data[$field['name']] = strings(arrays($this->data)->get($field['name']))->toInteger(); } @@ -128,7 +128,7 @@ public function getFields(): array default: case 'string': if (isset($field['value'])) { - $data[$field['name']] = strings(flextype('twig')->fetchFromString(strings($field['value'])->replace('__self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []))->toString(); + $data[$field['name']] = strings(flextype('twig')->fetchFromString(strings($field['value'])->replace('_self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []))->toString(); } else { $data[$field['name']] = strings(arrays($this->data)->get($field['name']))->toString(); } @@ -136,7 +136,7 @@ public function getFields(): array } } else { if (isset($field['value'])) { - $data[$field['name']] = flextype('twig')->fetchFromString(strings($field['value'])->replace('__self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []); + $data[$field['name']] = flextype('twig')->fetchFromString(strings($field['value'])->replace('_self.value', "'". arrays($this->data)->get($field['name']) . "'"), isset($field['data']) ? $field['data'] : []); } else { $data[$field['name']] = arrays($this->data)->get($field['name']); } @@ -178,13 +178,13 @@ public function getActions() $properties = array_values($action['properties']); foreach ($properties as $key => $field) { switch ($field) { - case '__self.fields': + case '_self.fields': $properties[$key] = $this->getFields(); break; - case '__self.messages': + case '_self.messages': $properties[$key] = $this->getMessages(); break; - case '__self.redirect': + case '_self.redirect': $properties[$key] = $this->getFields(); break; default: