diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type/ConfigType.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Form/Type/ConfigType.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 49b05b80..1f0ad89d 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -9,16 +9,20 @@ use Symfony\Component\OptionsResolver\OptionsResolver; | |||
9 | class ConfigType extends AbstractType | 9 | class ConfigType extends AbstractType |
10 | { | 10 | { |
11 | private $themes = array(); | 11 | private $themes = array(); |
12 | private $languages = array(); | ||
12 | 13 | ||
13 | /** | 14 | /** |
14 | * @param array $themes Themes come from the LiipThemeBundle (liip_theme.themes) | 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 | ||
15 | */ | 17 | */ |
16 | public function __construct($themes) | 18 | public function __construct($themes, $languages) |
17 | { | 19 | { |
18 | $this->themes = array_combine( | 20 | $this->themes = array_combine( |
19 | $themes, | 21 | $themes, |
20 | array_map(function ($s) { return ucwords(strtolower(str_replace('-', ' ', $s))); }, $themes) | 22 | array_map(function ($s) { return ucwords(strtolower(str_replace('-', ' ', $s))); }, $themes) |
21 | ); | 23 | ); |
24 | |||
25 | $this->languages = $languages; | ||
22 | } | 26 | } |
23 | 27 | ||
24 | public function buildForm(FormBuilderInterface $builder, array $options) | 28 | public function buildForm(FormBuilderInterface $builder, array $options) |
@@ -29,7 +33,9 @@ class ConfigType extends AbstractType | |||
29 | 'choices_as_values' => true, | 33 | 'choices_as_values' => true, |
30 | )) | 34 | )) |
31 | ->add('items_per_page') | 35 | ->add('items_per_page') |
32 | ->add('language') | 36 | ->add('language', 'choice', array( |
37 | 'choices' => $this->languages, | ||
38 | )) | ||
33 | ->add('save', 'submit') | 39 | ->add('save', 'submit') |
34 | ; | 40 | ; |
35 | } | 41 | } |