Skip to content

Commit

Permalink
type subscriber - choice value fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Padam87 committed Apr 15, 2013
1 parent 78f3872 commit e2e8a82
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Form/EventListener/AttributeTypeSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ public function createValueField($data, $form, $fieldName = 'value')
}

if ($type == 'choice' || $type == 'checkbox' || $type == 'radio') {
if (!is_array($value)) {
$value = array();
}

if (($type == 'checkbox' || $type == 'radio') && $this->getOption('allow_expanded')) {
$params['expanded'] = true;
}
Expand All @@ -92,6 +88,12 @@ public function createValueField($data, $form, $fieldName = 'value')
if ($type == 'radio') {
$params['multiple'] = false;
} elseif ($type == 'checkbox') {
if (!is_array($value)) {
$value = array(
$value => $value
);
}

$params['multiple'] = true;
}
}
Expand Down

0 comments on commit e2e8a82

Please sign in to comment.