main/core/Controller/HomeController.php
public function changeTemplateAction(Type $type, Request $request)
    {
        $form = $this->formFactory->create(
            HomeTemplateType::class,
            $type,
            ['dir' => $this->homeService->getTemplatesDirectory()]
        );
        $form->handleRequest($request);

        if ($form->isValid()) {
            $this->manager->persistType($type);

            return new JsonResponse('success', 200);
        } else {
            return ['form' => $form->createView(), 'type' => $type];
        }
    }
public function changeTemplateAction(Type $type, Request $request)
    {
        $form = $this->formFactory->create(
            HomeTemplateType::class,
            $type,
            ['dir' => $this->homeService->getTemplatesDirectory()]
        );
        $form->handleRequest($request);

        if ($form->isValid()) {
            $this->manager->persistType($type);

            return new JsonResponse('success', 200);
        } else {
            return ['form' => $form->createView(), 'type' => $type];
        }
    }
public function changeTemplateAction ( Type $ type , Request $ request ) { $ form = $ this -> formFactory -> create ( HomeTemplateType :: class , $ type , [ 'dir' => $ this -> homeService -> getTemplatesDirectory ( ) ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ this -> manager -> persistType ( $ type ) ; return new JsonResponse ( 'success' , 200 ) ; } else { return [ 'form' => $ form -> createView ( ) , 'type' => $ type ] ; } }
Edit template.

@Route(
"/type/{type}/change/template",
name="claro_content_change_template",
options = {"expose" = true}
)
@Secure(roles="ROLE_HOME_MANAGER")
@Template("ClarolineCoreBundle:home:change_template_modal_form.html.twig")

@param Type    $type
@param Request $request

@return Response|array
Edit template .