Test
public function Multiple(string $name, array $item = array(), $data = null): string { $label = $item["label"] ?? null; $required = isset($item["required"]) && $item["required"] == 1 ? "required validate[required]" : null; $required_label = isset($item["required"]) && $item["required"] == 1 ? "required" : null; $value = !empty($data) && isset($data[$name]) ? $data[$name] : null; $html = '<div class="form-group mb-3"> <label for="id_' . $name . '" class="' . $required_label . '">' . $label . '</label> < class="form-control 2bs4 ' . $required . '" name="' . $name . '[]" id="id_' . $name . '" multiple style="width: 100%;" > <option value="">Seçiniz</option>'; $each_item = null; foreach ($item["_item"] as $item_key => $item_value) { $each_item .= '<option value="' . $item_key . '" ' . (in_array($item_key,$value) ? "ed" : null) . '>' . $item_value . '</option>'; } $html .= $each_item . '</> </div>'; return $html; }