| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Helpers;
- class HtmlHelper {
- public static function renderOptions(array $options, $selected_value = null): void {
- foreach($options as $value => $display) {
- $selected = ((string) $value === (string) $selected_value) ? "selected" : "";
- ?>
- <option value="<?=htmlspecialchars($value)?>" <?=$selected?>>
- <?=htmlspecialchars($display)?>
- </option>
- <?php
- }
- }
- public static function renderInfoAlert(string $message): void {
- ?>
- <div class="alert alert-info">
- <i class="fa fa-fw fa-info-circle"></i>
- <?=htmlspecialchars($message)?>
- </div>
- <?php
- }
- public static function readonly($value): string {
- return $value ? "readonly" : "";
- }
- public static function hidden($value): string {
- return $value ? "hidden" : "";
- }
- }
|