From 87b5451d2d48410bfd83b0af4fa237afbf969342 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 21 Dec 2013 14:55:17 +1300 Subject: [PATCH] Consistent API for SelectionGroup constructor. --- forms/SelectionGroup.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/forms/SelectionGroup.php b/forms/SelectionGroup.php index 19390ce55..5e43fd03f 100644 --- a/forms/SelectionGroup.php +++ b/forms/SelectionGroup.php @@ -29,13 +29,19 @@ class SelectionGroup extends CompositeField { /** * Create a new selection group. * - * @param name The field name of the selection group. - * @param items The list of {@link SelectionGroup_Item} + * @param string $name The field name of the selection group. + * @param array $items The list of {@link SelectionGroup_Item} + * @param mixed $value */ - public function __construct($name, $items) { + public function __construct($name, $items, $value = null) { $this->name = $name; + if($value !== null) { + $this->setValue($value); + } + $selectionItems = array(); + foreach($items as $key => $item) { if($item instanceof SelectionGroup_Item) { $selectionItems[] = $item;