public function editAction($id, Request $request)
    {
        $template = $this->container->get('synapse.template.orm_loader')
            ->retrieveOne(array(
                'id' => $id,
                'scope' => TemplateInterface::GLOBAL_SCOPE
            ))
        ;
        if (!$template) {
            throw new NotFoundHttpException(sprintf('No global template found for id "%s"', $id));
        }

        $form = $this->container->get('form.factory')->createNamed(
            'template',
            TemplateType::class,
            $template,
            array(
                'theme' => $request->attributes->get(
                    'synapse_theme',
                    $this->container->get('synapse')
                        ->enableDefaultTheme()
                        ->getCurrentTheme()
                ),
                'content_type' => $template->getContentType(),
                'template_type' => $template->getTemplateType(),
                'action' => $formUrl = $this->container->get('router')->generate(
                    'synapse_admin_template_edition',
                    array('id' => $template->getId())
                ),
                'method' => 'POST',
                'csrf_protection' => false,
            )
        );
        if ($request->request->has('template')) {
            $form->handleRequest($request);
            if ($form->isValid()) {
                return $this->redirect(
                    $this->container->get('router')->generate(
                        'synapse_admin_template_edition',
                        array('id' => $template->getId())
                    )
                );
            }
        }

        return $this->render('SynapseAdminBundle:Template:edit.html.twig', array(
            'template' => $template,
            'form' => $form->createView(),
        ));
    }
public function editAction($id, Request $request)
    {
        $template = $this->container->get('synapse.template.orm_loader')
            ->retrieveOne(array(
                'id' => $id,
                'scope' => TemplateInterface::GLOBAL_SCOPE
            ))
        ;
        if (!$template) {
            throw new NotFoundHttpException(sprintf('No global template found for id "%s"', $id));
        }

        $form = $this->container->get('form.factory')->createNamed(
            'template',
            TemplateType::class,
            $template,
            array(
                'theme' => $request->attributes->get(
                    'synapse_theme',
                    $this->container->get('synapse')
                        ->enableDefaultTheme()
                        ->getCurrentTheme()
                ),
                'content_type' => $template->getContentType(),
                'template_type' => $template->getTemplateType(),
                'action' => $formUrl = $this->container->get('router')->generate(
                    'synapse_admin_template_edition',
                    array('id' => $template->getId())
                ),
                'method' => 'POST',
                'csrf_protection' => false,
            )
        );
        if ($request->request->has('template')) {
            $form->handleRequest($request);
            if ($form->isValid()) {
                return $this->redirect(
                    $this->container->get('router')->generate(
                        'synapse_admin_template_edition',
                        array('id' => $template->getId())
                    )
                );
            }
        }

        return $this->render('SynapseAdminBundle:Template:edit.html.twig', array(
            'template' => $template,
            'form' => $form->createView(),
        ));
    }
public function editAction ( $ id , Request $ request ) { $ template = $ this -> container -> get ( 'synapse.template.orm_loader' ) -> retrieveOne ( array ( 'id' => $ id , 'scope' => TemplateInterface :: GLOBAL_SCOPE ) ) ; if ( ! $ template ) { throw new NotFoundHttpException ( sprintf ( 'No global template found for id "%s"' , $ id ) ) ; } $ form = $ this -> container -> get ( 'form.factory' ) -> createNamed ( 'template' , TemplateType :: class , $ template , array ( 'theme' => $ request -> attributes -> get ( 'synapse_theme' , $ this -> container -> get ( 'synapse' ) -> enableDefaultTheme ( ) -> getCurrentTheme ( ) ) , 'content_type' => $ template -> getContentType ( ) , 'template_type' => $ template -> getTemplateType ( ) , 'action' => $ formUrl = $ this -> container -> get ( 'router' ) -> generate ( 'synapse_admin_template_edition' , array ( 'id' => $ template -> getId ( ) ) ) , 'method' => 'POST' , 'csrf_protection' => false , ) ) ; if ( $ request -> request -> has ( 'template' ) ) { $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { return $ this -> redirect ( $ this -> container -> get ( 'router' ) -> generate ( 'synapse_admin_template_edition' , array ( 'id' => $ template -> getId ( ) ) ) ) ; } } return $ this -> render ( 'SynapseAdminBundle:Template:edit.html.twig' , array ( 'template' => $ template , 'form' => $ form -> createView ( ) , ) ) ; }
Global template edition action.
Requires an activated or activable theme.

@param Request $request

@return Response
Global template edition action . Requires an activated or activable theme .