mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 06:14:23 +00:00
adding empty data on CFChoice
And fixing a bug occuring because type of empty data are wrong. fix #23
This commit is contained in:
parent
2e59c0666b
commit
affeae238c
@ -123,26 +123,26 @@ class CustomFieldChoice extends AbstractCustomField
|
|||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
'multiple' => false,
|
'multiple' => false,
|
||||||
'choices' => array(
|
'choices' => array(
|
||||||
1 => 'Multiple',
|
'1' => 'Multiple',
|
||||||
0 => 'Unique'),
|
'0' => 'Unique'),
|
||||||
'empty_data' => 0,
|
'empty_data' => '0',
|
||||||
'label' => 'Multiplicity'
|
'label' => 'Multiplicity'
|
||||||
))
|
))
|
||||||
->add(self::EXPANDED, 'choice', array(
|
->add(self::EXPANDED, 'choice', array(
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
'multiple' => false,
|
'multiple' => false,
|
||||||
'choices' => array(
|
'choices' => array(
|
||||||
1 => 'Expanded',
|
'1' => 'Expanded',
|
||||||
0 => 'Non expanded'),
|
'0' => 'Non expanded'),
|
||||||
'empty_data' => 0,
|
'empty_data' => '0',
|
||||||
'label' => 'Choice display'
|
'label' => 'Choice display'
|
||||||
))
|
))
|
||||||
->add(self::ALLOW_OTHER, 'choice', array(
|
->add(self::ALLOW_OTHER, 'choice', array(
|
||||||
'label' => 'Allow other',
|
'label' => 'Allow other',
|
||||||
'choices' => array(
|
'choices' => array(
|
||||||
0 => 'No',
|
'0' => 'No',
|
||||||
1 => 'Yes'),
|
'1' => 'Yes'),
|
||||||
'empty_data' => 0,
|
'empty_data' => '0',
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
'multiple' => false
|
'multiple' => false
|
||||||
))
|
))
|
||||||
|
@ -30,11 +30,13 @@ class ChoiceWithOtherType extends AbstractType
|
|||||||
$options['choices']['_other'] = $this->otherValueLabel;
|
$options['choices']['_other'] = $this->otherValueLabel;
|
||||||
//ChoiceWithOther must always be expanded
|
//ChoiceWithOther must always be expanded
|
||||||
$options['expanded'] = true;
|
$options['expanded'] = true;
|
||||||
|
// adding a default value for choice
|
||||||
|
$options['empty_data'] = null;
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('_other', 'text', array('required' => false))
|
->add('_other', 'text', array('required' => false))
|
||||||
->add('_choices', 'choice', $options)
|
->add('_choices', 'choice', $options)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-PHPdoc)
|
/* (non-PHPdoc)
|
||||||
@ -45,7 +47,9 @@ class ChoiceWithOtherType extends AbstractType
|
|||||||
$resolver
|
$resolver
|
||||||
->setRequired(array('choices'))
|
->setRequired(array('choices'))
|
||||||
->setAllowedTypes(array('choices' => array('array')))
|
->setAllowedTypes(array('choices' => array('array')))
|
||||||
->setDefaults(array('multiple' => false))
|
->setDefaults(array(
|
||||||
|
'multiple' => false,
|
||||||
|
))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user