|
- <?php
-
- namespace Lc\SovBundle\Controller\Setting;
-
- use Lc\SovBundle\Container\Setting\SiteSettingContainer;
- use Lc\SovBundle\Controller\AbstractController;
- use Lc\SovBundle\Form\Setting\SiteSettingsFormType;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\Routing\Annotation\Route;
-
- class SettingAdminController extends AbstractController
- {
- #[Route(path: '/admin/setting/site', name: 'sov_admin_setting_site')]
- public function manageGlobal(Request $request)
- {
- $entityManager = $this->getEntityManager();
- $site = $this->getSiteContainer()->getStore()->getOneByDevAlias('default') ;
- $form = $this->createForm(SiteSettingsFormType::class, $site);
-
- $form->handleRequest($request);
-
- if ($form->isSubmitted() && $form->isValid()) {
-
- $entityManager->update($site);
- $entityManager->flush();
-
- $this->addFlashTranslator('success', 'updated');
- }
-
- return $this->render(
- '@LcSov/admin/setting/edit_site.html.twig' ,
- [
- 'setting_definition' => $this->get(SiteSettingContainer::class)->getDefinition(),
- 'form' => $form->createView()
- ]
- );
- }
-
- }
|