| 1234567891011121314151617181920212223242526 |
- <?php
- class HtmlHelper {
- public static function selected(?string $value, ?string $selected): string {
- return ((string) $value === (string) $selected) ? "selected" : "";
- }
- public static function renderOptions(array $options, ?string $selected): void {
- foreach($options as $value => $display) {
- ?>
- <option value="<?=$value?>" <?=self::selected($value, $selected)?>>
- <?=htmlspecialchars($display)?>
- </option>
- <?php
- }
- }
- public static function getYesNoOptions(): array {
- return [
- 1 => __("Yes"),
- 0 => __("No")
- ];
- }
- }
|