first commit

This commit is contained in:
kali
2024-05-28 17:10:06 +03:00
parent 92b3d15cc7
commit 49a337bd0f
43 changed files with 1799 additions and 0 deletions

21
traits/CreateOption.php Executable file
View File

@@ -0,0 +1,21 @@
<?php
namespace itguild\forms\form\traits;
trait CreateOption
{
/**
* @param array $options
* @param $value
* @return string
*/
public function createOption(array $options, $value = null): string
{
$optionsString = "";
foreach ($options as $val => $title){
$selected = (int)$value === $val ? "selected" : "";
$optionsString .= "<option $selected value='$val'>$title</option>";
}
return $optionsString;
}
}