Explorar o código

Changed field layout for form class render methods.

Alan Lam %!s(int64=8) %!d(string=hai) anos
pai
achega
0dee283cdb
Modificáronse 1 ficheiros con 29 adicións e 21 borrados
  1. 29 21
      engine/form.php

+ 29 - 21
engine/form.php

@@ -74,9 +74,11 @@ class Form {
 		$value = $options->value ?? http::value($options->name);
 		$value = $options->value ?? http::value($options->name);
 		$required = ($options->required ?? false) ? "required" : "";
 		$required = ($options->required ?? false) ? "required" : "";
 		?>
 		?>
-		<div class="form-group">
-			<label for="<?=$id?>"><?=htmlspecialchars($options->label)?></label>
-			<input class="form-control" type="text" name="<?=$options->name?>" id="<?=$id?>" placeholder="<?=htmlspecialchars($placeholder)?>" value="<?=htmlspecialchars($value)?>" <?=$required?> />
+		<div class="row mb-1">
+			<label class="col-sm-4 col-form-label" for="<?=$id?>"><?=htmlspecialchars($options->label)?></label>
+			<div class="col-sm">
+				<input class="form-control" type="text" name="<?=$options->name?>" id="<?=$id?>" placeholder="<?=htmlspecialchars($placeholder)?>" value="<?=htmlspecialchars($value)?>" <?=$required?> />
+			</div>
 		</div>
 		</div>
 		<?php
 		<?php
 	}
 	}
@@ -87,19 +89,21 @@ class Form {
 		$required = ($options->required ?? false) ? "required" : "";
 		$required = ($options->required ?? false) ? "required" : "";
 
 
 		?>
 		?>
-		<div class="form-group">
-			<label for="<?=$id?>"><?=htmlspecialchars($options->label)?></label>
-			<select class="form-control" name="<?=$options->name?>" id="<?=$id?>" <?=$required?>>
-			<?php
-			foreach($options->values as $index => $value) {
-				$display = $options->displayStrings[$index];
-				$selected = ($selected_value === strval($value)) ? "selected" : "";
-				?>
-				<option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
+		<div class="row mb-1">
+			<label class="col-sm-4 col-form-label" for="<?=$id?>"><?=htmlspecialchars($options->label)?></label>
+			<div class="col-sm">
+				<select class="form-control" name="<?=$options->name?>" id="<?=$id?>" <?=$required?>>
 				<?php
 				<?php
-			}
-			?>
-			</select>
+				foreach($options->values as $index => $value) {
+					$display = $options->displayStrings[$index];
+					$selected = ($selected_value === strval($value)) ? "selected" : "";
+					?>
+					<option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
+					<?php
+				}
+				?>
+				</select>
+			</div>
 		</div>
 		</div>
 		<?php
 		<?php
 	}
 	}
@@ -109,9 +113,11 @@ class Form {
 		$placeholder = "Enter " . strtolower($options->label);
 		$placeholder = "Enter " . strtolower($options->label);
 		$required = ($options->required ?? false) ? "required" : "";
 		$required = ($options->required ?? false) ? "required" : "";
 		?>
 		?>
-		<div class="form-group">
-			<label for="<?=$id?>"><?=htmlspecialchars($options->label)?></label>
-			<input class="form-control-file" type="file" name="<?=$options->name?>" id="<?=$id?>" accept="image/*" capture="camera" <?=$required?> />
+		<div class="row mb-1">
+			<label class="col-sm-4 col-form-label" for="<?=$id?>"><?=htmlspecialchars($options->label)?></label>
+			<div class="col-sm">
+				<input class="form-control-file" type="file" name="<?=$options->name?>" id="<?=$id?>" accept="image/*" capture="camera" <?=$required?> />
+			</div>
 		</div>
 		</div>
 		<?php
 		<?php
 	}
 	}
@@ -122,9 +128,11 @@ class Form {
 		$value = $options->value ?? http::value($options->name);
 		$value = $options->value ?? http::value($options->name);
 		$required = ($options->required ?? false) ? "required" : "";
 		$required = ($options->required ?? false) ? "required" : "";
 		?>
 		?>
-		<div class="form-group">
-			<label for="<?=$id?>"><?=htmlspecialchars($options->label)?></label>
-			<textarea class="form-control" name="<?=$options->name?>" id="<?=$id?>" placeholder="<?=htmlspecialchars($placeholder)?>" rows="4" <?=$required?>><?=htmlspecialchars($value)?></textarea>
+		<div class="row mb-1">
+			<label class="col-sm-4 col-form-label" for="<?=$id?>"><?=htmlspecialchars($options->label)?></label>
+			<div class="col-sm">
+				<textarea class="form-control" name="<?=$options->name?>" id="<?=$id?>" placeholder="<?=htmlspecialchars($placeholder)?>" rows="4" <?=$required?>><?=htmlspecialchars($value)?></textarea>
+			</div>
 		</div>
 		</div>
 		<?php
 		<?php
 	}
 	}