From f6bfb89b2912933f638416135dff7bb8cb28890d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 21 Feb 2021 23:18:32 +0300 Subject: pref-prefs: switch to new control shorthand in a few places --- include/controls.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/controls.php') diff --git a/include/controls.php b/include/controls.php index e3349d31b..b65a166c2 100755 --- a/include/controls.php +++ b/include/controls.php @@ -5,6 +5,11 @@ $rv = ""; foreach ($attributes as $k => $v) { + + // special handling for "disabled" + if ($k === "disabled" && !sql_bool_to_bool($v)) + continue; + $rv .= "$k=\"" . htmlspecialchars($v) . "\""; } @@ -30,6 +35,18 @@ return ""; } + function input_tag(string $name, string $value, string $type = "text", array $attributes = [], string $id = "") { + $attributes_str = attributes_to_string($attributes); + $dojo_type = strpos($attributes_str, "dojoType") === false ? "dojoType='dijit.form.TextBox'" : ""; + + return ""; + } + + function number_spinner_tag(string $name, string $value, array $attributes = [], string $id = "") { + return input_tag($name, $value, "text", array_merge(["dojoType" => "dijit.form.NumberSpinner"], $attributes), $id); + } + function submit_tag(string $value, array $attributes = []) { return button_tag($value, "submit", array_merge(["class" => "alt-primary"], $attributes)); } -- cgit v1.2.3