Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

40 lines
1.2KB

  1. <?php
  2. namespace Lc\SovBundle\Controller\Setting;
  3. use Lc\SovBundle\Container\Setting\SiteSettingContainer;
  4. use Lc\SovBundle\Controller\AbstractController;
  5. use Lc\SovBundle\Form\Setting\SiteSettingsFormType;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class SettingAdminController extends AbstractController
  9. {
  10. #[Route(path: '/admin/setting/site', name: 'sov_admin_setting_site')]
  11. public function manageGlobal(Request $request)
  12. {
  13. $entityManager = $this->getEntityManager();
  14. $site = $this->getSiteContainer()->getStore()->getOneByDevAlias('default') ;
  15. $form = $this->createForm(SiteSettingsFormType::class, $site);
  16. $form->handleRequest($request);
  17. if ($form->isSubmitted() && $form->isValid()) {
  18. $entityManager->update($site);
  19. $entityManager->flush();
  20. $this->addFlashTranslator('success', 'updated');
  21. }
  22. return $this->render(
  23. '@LcSov/admin/setting/edit_site.html.twig' ,
  24. [
  25. 'setting_definition' => $this->get(SiteSettingContainer::class)->getDefinition(),
  26. 'form' => $form->createView()
  27. ]
  28. );
  29. }
  30. }