Commit a7011f4d896dd17e47b5d1682727e61e88e0cb48
1 parent
e9165342
Exists in
master
and in
66 other branches
Generated list for arguments of a templated parameter
Showing
1 changed file
with
15 additions
and
2 deletions
Show diff stats
src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php
... | ... | @@ -18,6 +18,9 @@ class IHMParamTemplateClass |
18 | 18 | protected static $paramTemplateArgumentKeyAtt = 'key'; |
19 | 19 | protected static $paramTemplateArgumentNameAtt = 'name'; |
20 | 20 | protected static $paramTemplateArgumentTypeAtt = 'type'; |
21 | + protected static $paramTemplateArgumentMinKeyAtt = 'minkey'; | |
22 | + protected static $paramTemplateArgumentMaxKeyAtt = 'maxkey'; | |
23 | + protected static $paramTemplateArgumentNameTplAtt = 'nametpl'; | |
21 | 24 | protected static $paramTemplateArgumentDefaultAtt = 'default'; |
22 | 25 | protected static $paramTemplateArgumentListItemNode = 'item'; |
23 | 26 | protected static $paramTemplateArgumentListItemKeyAtt = 'key'; |
... | ... | @@ -263,6 +266,9 @@ class IHMParamTemplateClass |
263 | 266 | $argumentName = $argumentNode->getAttribute(self::$paramTemplateArgumentNameAtt); |
264 | 267 | $argumentType = $argumentNode->getAttribute(self::$paramTemplateArgumentTypeAtt); |
265 | 268 | $argumentDefault = $argumentNode->getAttribute(self::$paramTemplateArgumentDefaultAtt); |
269 | + $argumentMinKey = $argumentNode->getAttribute(self::$paramTemplateArgumentMinKeyAtt); | |
270 | + $argumentMaxKey = $argumentNode->getAttribute(self::$paramTemplateArgumentMaxKeyAtt); | |
271 | + $argumentNameTpl = $argumentNode->getAttribute(self::$paramTemplateArgumentNameTplAtt); | |
266 | 272 | |
267 | 273 | if (empty($argumentKey) || empty($argumentType)) |
268 | 274 | continue; |
... | ... | @@ -285,7 +291,14 @@ class IHMParamTemplateClass |
285 | 291 | continue; |
286 | 292 | $arguments[$argumentKey]['items'][$itemKey] = (empty($itemName) ? $itemKey : $itemName); |
287 | 293 | } |
288 | - | |
294 | + break; | |
295 | + case "generated-list": | |
296 | + $arguments[$argumentKey]['type'] = 'list'; | |
297 | + $arguments[$argumentKey]['items'] = array(); | |
298 | + for ($key = intval($argumentMinKey) ; $key <= intval($argumentMaxKey); ++$key) { | |
299 | + $itemName = str_replace('##key##',$key,$argumentNameTpl); | |
300 | + $arguments[$argumentKey]['items'][strval($key)] = $itemName; | |
301 | + } | |
289 | 302 | break; |
290 | 303 | default: |
291 | 304 | //Nothing to do |
... | ... | @@ -300,4 +313,4 @@ class IHMParamTemplateClass |
300 | 313 | |
301 | 314 | } |
302 | 315 | } |
303 | -} | |
304 | 316 | \ No newline at end of file |
317 | +} | ... | ... |