public static function Factory($name, $checkboxList, $label, $required = false, $checked = null) { $fieldSet = FieldSet::Factory($name . '_list', $label); if (is_array($checkboxList) && !empty($checkboxList)) { $i = 0; foreach ($checkboxList as $value => $label) { $id = $name . ++$i; $fieldSet->addElement(InputCheckbox::Factory($name, $value, $label, $id)); } } return $fieldSet; }