3 namespace Wallabag\CoreBundle\Form\Type
;
5 use Symfony\Component\Form\AbstractType
;
6 use Symfony\Component\Form\FormBuilderInterface
;
7 use Symfony\Component\OptionsResolver\OptionsResolver
;
9 class ConfigType
extends AbstractType
11 private $themes = array();
12 private $languages = array();
15 * @param array $themes Themes come from the LiipThemeBundle (liip_theme.themes)
16 * @param array $languages Languages come from configuration, array just code language as key and label as value
18 public function __construct($themes, $languages)
20 $this->themes
= array_combine(
22 array_map(function ($s) { return ucwords(strtolower(str_replace('-', ' ', $s
))); }, $themes)
25 $this->languages
= $languages;
28 public function buildForm(FormBuilderInterface
$builder, array $options)
31 ->add('theme', 'choice', array(
32 'choices' => array_flip($this->themes
),
33 'choices_as_values' => true,
35 ->add('items_per_page')
36 ->add('language', 'choice', array(
37 'choices' => $this->languages
,
39 ->add('save', 'submit')
43 public function configureOptions(OptionsResolver
$resolver)
45 $resolver->setDefaults(array(
46 'data_class' => 'Wallabag\CoreBundle\Entity\Config',
50 public function getName()