From ddb17cc47360910b3875b88e10e14f91fcd875be Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Tue, 10 Sep 2024 11:41:16 +0300 Subject: [PATCH 1/2] add enctypy --- src/ActiveForm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ActiveForm.php b/src/ActiveForm.php index ced9893..367724f 100755 --- a/src/ActiveForm.php +++ b/src/ActiveForm.php @@ -31,9 +31,9 @@ class ActiveForm * @param string $action * @return void */ - public function beginForm(string $action): void + public function beginForm(string $action, string $enctype = 'application/x-www-form-urlencoded'): void { - echo "
"; + echo ""; } /** From 45e57367d3f9571fde2b82fa2fd8126469ba6db6 Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Thu, 28 Nov 2024 13:18:58 +0300 Subject: [PATCH 2/2] create option trait update: value can be array already --- src/traits/CreateOption.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/traits/CreateOption.php b/src/traits/CreateOption.php index 0ba5071..ffc3f15 100755 --- a/src/traits/CreateOption.php +++ b/src/traits/CreateOption.php @@ -12,10 +12,18 @@ trait CreateOption public function createOption(array $options, $value = null): string { $optionsString = ""; - foreach ($options as $val => $title){ - $selected = (int)$value === $val ? "selected" : ""; - $optionsString .= ""; + if (is_array($value)) { + foreach ($options as $val => $title) { + $selected = in_array($title, $value) ? "selected" : ""; + $optionsString .= ""; + } + } else { + foreach ($options as $val => $title) { + $selected = (int)$value === $val ? "selected" : ""; + $optionsString .= ""; + } } + return $optionsString; } } \ No newline at end of file