themes = array_combine( $themes, array_map(function ($s) { return ucwords(strtolower(str_replace('-', ' ', $s))); }, $themes) ); $this->languages = $languages; } public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('theme', ChoiceType::class, array( 'choices' => array_flip($this->themes), 'choices_as_values' => true, )) ->add('items_per_page') ->add('reading_speed', ChoiceType::class, array( 'choices' => array( 'I read ~100 words per minute' => '0.5', 'I read ~200 words per minute' => '1', 'I read ~300 words per minute' => '1.5', 'I read ~400 words per minute' => '2', ), )) ->add('language', ChoiceType::class, array( 'choices' => array_flip($this->languages), 'choices_as_values' => true, )) ->add('save', SubmitType::class) ; } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'Wallabag\CoreBundle\Entity\Config', )); } public function getBlockPrefix() { return 'config'; } }