Merge remote-tracking branch 'upstream/master'

This commit is contained in:
ORelio 2016-02-20 14:58:19 +01:00
commit 0071a9fe2c
2 changed files with 22 additions and 1 deletions

View file

@ -59,6 +59,8 @@ The array can be a key-based array, but it is not necessary. The following synta
$this->parameters[] = ...
$this->parameters['First usage of my bridge'] = ...
```
It is worth mentionning that you can also define a set of parameters that will be applied to every possible utilisation of your bridge.
To do this, just create a parameter array with the `global` key.
### Format specifications

View file

@ -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 .= '<h5>'.$parameterName.'</h5>' . PHP_EOL;
}
@ -65,7 +85,6 @@ CARD;
<input type="hidden" name="action" value="display" />
<input type="hidden" name="bridge" value="' . $bridgeName . '" />' . PHP_EOL;
$parameter = json_decode($parameter, true);
foreach($parameter as $inputEntry) {