aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-10-01 16:28:38 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-10-15 21:42:29 +0200
commitc89d35e851d26b78f89bd7ece5e3eaa109c8cac0 (patch)
tree554523b6b376d258fbf82b8ef8ec16236f774b5f /src/Wallabag/CoreBundle/Form/Type/ConfigType.php
parent3d3ed955f11006a408c6596eb9151a0afb28e721 (diff)
downloadwallabag-c89d35e851d26b78f89bd7ece5e3eaa109c8cac0.tar.gz
wallabag-c89d35e851d26b78f89bd7ece5e3eaa109c8cac0.tar.zst
wallabag-c89d35e851d26b78f89bd7ece5e3eaa109c8cac0.zip
Language selection on config screen
Diffstat (limited to 'src/Wallabag/CoreBundle/Form/Type/ConfigType.php')
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ConfigType.php12
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;
9class ConfigType extends AbstractType 9class 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 }