- foreach ($optvals as $optset) {
- if (isset($optset['posvals'])) {
- /* Create a new option with all values given. */
- $result[] = new SquirrelOption(
- $optset['name'],
- $optset['caption'],
- $optset['type'],
- $optset['refresh'],
- $optset['posvals']
- );
- } else {
- /* Create a new option with all but possible values given. */
- $result[] = new SquirrelOption(
- $optset['name'],
- $optset['caption'],
- $optset['type'],
- $optset['refresh']
- );
+ foreach ($optvals as $grpkey => $grpopts) {
+ foreach ($grpopts as $optset) {
+ if (isset($optset['posvals'])) {
+ /* Create a new option with all values given. */
+ $next_option = new SquirrelOption(
+ $optset['name'],
+ $optset['caption'],
+ $optset['type'],
+ $optset['refresh'],
+ $optset['posvals']
+ );
+ } else {
+ /* Create a new option with all but possible values given. */
+ $next_option = new SquirrelOption(
+ $optset['name'],
+ $optset['caption'],
+ $optset['type'],
+ $optset['refresh']
+ );
+ }
+
+ /* If provided, set the size for this option. */
+ if (isset($optset['size'])) {
+ $next_option->setSize($optset['size']);
+ }
+
+ /* If provided, set the comment for this option. */
+ if (isset($optset['comment'])) {
+ $next_option->setComment($optset['comment']);
+ }
+
+ /* Add this option to the option array. */
+ $result[$grpkey]['options'][] = $next_option;