mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 13:33:48 +00:00
fix deprecation error: use gqcn and pass option in array
This commit is contained in:
@@ -17,19 +17,12 @@ class ChoiceWithOtherType extends AbstractType
|
||||
{
|
||||
private $otherValueLabel = 'Other value';
|
||||
|
||||
public function __construct($otherValueLabel = Null) {
|
||||
if($otherValueLabel) {
|
||||
$this->otherValueLabel = $otherValueLabel;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-PHPdoc)
|
||||
* @see \Symfony\Component\Form\AbstractType::buildForm()
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
|
||||
//$otherValueLabel = $options['other_value_label'];
|
||||
//add an 'other' entry in choices array
|
||||
$options['choices'][$this->otherValueLabel] = '_other';
|
||||
//ChoiceWithOther must always be expanded
|
||||
@@ -52,9 +45,8 @@ class ChoiceWithOtherType extends AbstractType
|
||||
$resolver
|
||||
->setRequired(array('choices'))
|
||||
->setAllowedTypes('choices', array('array'))
|
||||
//->setDefault('other_value_label', null)
|
||||
->setDefaults(array(
|
||||
'multiple' => false,
|
||||
'multiple' => false
|
||||
))
|
||||
;
|
||||
}
|
||||
|
Reference in New Issue
Block a user