From f8b947062263de99ed61a462acb5502e451cf53d Mon Sep 17 00:00:00 2001 From: "teromene@teromene.fr" Date: Thu, 11 Feb 2016 15:24:40 +0000 Subject: [PATCH] Added the possibility to use a global array parameter, that is going to be displayed for every parameter count. --- lib/HTMLUtils.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/HTMLUtils.php b/lib/HTMLUtils.php index dce8b8f..4e6b5e2 100644 --- a/lib/HTMLUtils.php +++ b/lib/HTMLUtils.php @@ -56,8 +56,28 @@ CARD; } + $hasGlobalParameter = array_key_exists("global", $bridgeElement->parameters); + if($hasGlobalParameter) { + $globalParameters = json_decode($bridgeElement->parameters['global'], true); + } + foreach($bridgeElement->parameters as $parameterName => $parameter) { + + $parameter = json_decode($parameter, true); + + if(!is_numeric($parameterName) && $parameterName == "global") { + + continue; + + } + + if($hasGlobalParameter) { + + $parameter = array_merge($parameter, $globalParameters); + + } + if(!is_numeric($parameterName)) { $card .= '
'.$parameterName.'
' . PHP_EOL; } @@ -65,7 +85,6 @@ CARD; ' . PHP_EOL; - $parameter = json_decode($parameter, true); foreach($parameter as $inputEntry) {