From 2be14e028477c01b9fe2d13b9970a93ccfe640a1 Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 11 Nov 2019 21:09:10 +0300 Subject: [PATCH] refactor(core): Forms API refactoring --- flextype/core/Forms.php | 65 ++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/flextype/core/Forms.php b/flextype/core/Forms.php index cf465fde..ec25ab1d 100644 --- a/flextype/core/Forms.php +++ b/flextype/core/Forms.php @@ -185,7 +185,6 @@ class Forms } $form .= $form_field; - } $form .= ''; $form .= ''; @@ -253,9 +252,9 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param array $options Field options - * @param string $value Field value - * @param array $property Field property + * @param array $options Field options + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -265,7 +264,7 @@ class Forms { $property['attributes']['id'] = $field_id; - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); $field .= Form::select($field_name, $options, $value, $property['attributes']); $field .= ($property['help'] ? '' . __($property['help']) . '' : ''); @@ -279,8 +278,8 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param string $value Field value - * @param array $property Field property + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -302,7 +301,7 @@ class Forms } } - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); $field .= Form::select($field_name, $options, $value, $property['attributes']); $field .= ($property['help'] ? '' . __($property['help']) . '' : ''); @@ -316,9 +315,9 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param array $options Field options - * @param string $value Field value - * @param array $property Field property + * @param array $options Field options + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -328,7 +327,7 @@ class Forms { $property['attributes']['id'] = $field_id; - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); $field .= Form::select($field_name, $options, $value, $property['attributes']); $field .= ($property['help'] ? '' . __($property['help']) . '' : ''); @@ -342,8 +341,8 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param string $value Field value - * @param array $property Field property + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -351,10 +350,10 @@ class Forms */ protected function htmlField(string $field_id, string $field_name, string $value, array $property) : string { - $property['attributes']['id'] = $field_id; + $property['attributes']['id'] = $field_id; $property['attributes']['class'] .= ' js-html-editor'; - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); $field .= Form::textarea($field_name, $value, $property['attributes']); $field .= ($property['help'] ? '' . __($property['help']) . '' : ''); @@ -368,8 +367,8 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param string $value Field value - * @param array $property Field property + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -387,8 +386,8 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param string $value Field value - * @param array $property Field property + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -398,7 +397,7 @@ class Forms { $property['attributes']['id'] = $field_id; - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); $field .= Form::textarea($field_name, $value, $property['attributes']); $field .= ($property['help'] ? '' . __($property['help']) . '' : ''); @@ -412,8 +411,8 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param string $value Field value - * @param array $property Field property + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -423,7 +422,7 @@ class Forms { $property['attributes']['id'] = $field_id; - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); $field .= Form::select($field_name, $options, $value, $property['attributes']); $field .= ($property['help'] ? '' . __($property['help']) . '' : ''); @@ -437,8 +436,8 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param string $value Field value - * @param array $property Field property + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -448,7 +447,7 @@ class Forms { $property['attributes']['id'] = $field_id; - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); $field .= Form::input($field_name, $value, $property['attributes']); $field .= ($property['help'] ? '' . __($property['help']) . '' : ''); @@ -462,7 +461,7 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param string $value Field value + * @param string $value Field value * * @return string Returns field * @@ -472,9 +471,9 @@ class Forms { $property['attributes']['id'] = $field_id; - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); - $field .= ''; + $field .= ''; $field .= ($property['help'] ? '' . __($property['help']) . '' : ''); $field .= '
'; @@ -486,8 +485,8 @@ class Forms * * @param string $field_id Field ID * @param string $field_name Field name - * @param string $value Field value - * @param array $property Field property + * @param string $value Field value + * @param array $property Field property * * @return string Returns field * @@ -495,7 +494,7 @@ class Forms */ protected function dateField(string $field_id, string $field_name, string $value, array $property) : string { - $field = '
'; + $field = '
'; $field .= ($property['title'] ? Form::label($field_id, __($property['title'])) : ''); $field .= '
'; $field .= '