From 5d66af7a29a1a24c8642efecd7aa1cba5f60cd7f Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Mon, 15 Aug 2016 02:47:22 +0200 Subject: [PATCH] [HTMLUtils] Add new attribute 'defaultValue' Behavior depends on the type: - text: Allows any text - number: Allows any numeric - list: 'defaultValue' must match either name or value of one element - checkbox: 'defaultValue' must be checked to activate checkbox --- lib/HTMLUtils.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/HTMLUtils.php b/lib/HTMLUtils.php index 1a947715..8d39dc54 100644 --- a/lib/HTMLUtils.php +++ b/lib/HTMLUtils.php @@ -85,23 +85,32 @@ CARD; if(!isset($inputEntry['exampleValue'])) $inputEntry['exampleValue'] = ''; + if(!isset($inputEntry['defaultValue'])) + $inputEntry['defaultValue'] = ''; + $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode($parameterName) . '-' . urlencode($inputEntry['identifier']); $card .= '' . PHP_EOL; if(!isset($inputEntry['type']) || $inputEntry['type'] == 'text') { - $card .= '
' . PHP_EOL; + $card .= '
' . PHP_EOL; } else if($inputEntry['type'] == 'number') { - $card .= '
' . PHP_EOL; + $card .= '
' . PHP_EOL; } else if($inputEntry['type'] == 'list') { $card .= '
'; } else if($inputEntry['type'] == 'checkbox') { - $card .= '
' . PHP_EOL; + if($inputEntry['defaultValue'] === 'checked') + $card .= '
' . PHP_EOL; + else + $card .= '
' . PHP_EOL; } }