]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/ConfigController.php
Add LiipThemeBundle
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / ConfigController.php
index 68e034fa7a9588def73786d3ddbb0a274fcbf93e..4e89587599c94b2f8750a9ebd2cc27868c73c0ac 100644 (file)
@@ -7,7 +7,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 use Symfony\Component\HttpFoundation\Request;
 use Wallabag\CoreBundle\Entity\Config;
 use Wallabag\CoreBundle\Entity\User;
-use Wallabag\CoreBundle\Form\Type\ConfigType;
 use Wallabag\CoreBundle\Form\Type\ChangePasswordType;
 use Wallabag\CoreBundle\Form\Type\UserType;
 use Wallabag\CoreBundle\Form\Type\NewUserType;
@@ -25,14 +24,18 @@ class ConfigController extends Controller
         $config = $this->getConfig();
         $user = $this->getUser();
 
-        // handle basic config detail
-        $configForm = $this->createForm(new ConfigType(), $config);
+        // handle basic config detail (this form is defined as a service)
+        $configForm = $this->createForm('config', $config);
         $configForm->handleRequest($request);
 
         if ($configForm->isValid()) {
             $em->persist($config);
             $em->flush();
 
+            // switch active theme
+            $activeTheme = $this->get('liip_theme.active_theme');
+            $activeTheme->setName($config->getTheme());
+
             $this->get('session')->getFlashBag()->add(
                 'notice',
                 'Config saved'