1111
1212namespace Translation \Bundle \Controller ;
1313
14- use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
1514use Symfony \Component \HttpFoundation \Request ;
1615use Symfony \Component \HttpFoundation \Response ;
1716use Symfony \Component \HttpKernel \Exception \BadRequestHttpException ;
2928use Translation \Common \Exception \StorageException ;
3029use Translation \Common \Model \Message ;
3130use Translation \Common \Model \MessageInterface ;
31+ use Twig \Environment ;
3232
3333/**
3434 * @author Tobias Nyholm <tobias.nyholm@gmail.com>
3535 */
36- class WebUIController extends AbstractController
36+ class WebUIController
3737{
3838 private $ configurationManager ;
3939 private $ catalogueFetcher ;
4040 private $ catalogueManager ;
4141 private $ storageManager ;
4242 private $ validator ;
43+ private $ twig ;
4344 private $ locales ;
4445 private $ isWebUIEnabled ;
4546 private $ isWebUIAllowCreate ;
@@ -52,6 +53,7 @@ public function __construct(
5253 CatalogueManager $ catalogueManager ,
5354 StorageManager $ storageManager ,
5455 ValidatorInterface $ validator ,
56+ Environment $ twig ,
5557 array $ locales ,
5658 bool $ isWebUIEnabled ,
5759 bool $ isWebUIAllowCreate ,
@@ -63,6 +65,7 @@ public function __construct(
6365 $ this ->catalogueManager = $ catalogueManager ;
6466 $ this ->storageManager = $ storageManager ;
6567 $ this ->validator = $ validator ;
68+ $ this ->twig = $ twig ;
6669 $ this ->locales = $ locales ;
6770 $ this ->isWebUIEnabled = $ isWebUIEnabled ;
6871 $ this ->isWebUIAllowCreate = $ isWebUIAllowCreate ;
@@ -107,7 +110,7 @@ public function indexAction(?string $configName = null): Response
107110 }
108111 }
109112
110- return $ this ->render ('@Translation/WebUI/index.html.twig ' , [
113+ $ content = $ this -> twig ->render ('@Translation/WebUI/index.html.twig ' , [
111114 'catalogues ' => $ catalogues ,
112115 'catalogueSize ' => $ catalogueSize ,
113116 'maxDomainSize ' => $ maxDomainSize ,
@@ -116,6 +119,8 @@ public function indexAction(?string $configName = null): Response
116119 'configName ' => $ config ->getName (),
117120 'configNames ' => $ this ->configurationManager ->getNames (),
118121 ]);
122+
123+ return new Response ($ content );
119124 }
120125
121126 /**
@@ -137,7 +142,7 @@ public function showAction(string $configName, string $locale, string $domain):
137142 return \strcmp ($ a ->getKey (), $ b ->getKey ());
138143 });
139144
140- return $ this ->render ('@Translation/WebUI/show.html.twig ' , [
145+ $ content = $ this -> twig ->render ('@Translation/WebUI/show.html.twig ' , [
141146 'messages ' => $ messages ,
142147 'domains ' => $ this ->catalogueManager ->getDomains (),
143148 'currentDomain ' => $ domain ,
@@ -149,6 +154,8 @@ public function showAction(string $configName, string $locale, string $domain):
149154 'allow_delete ' => $ this ->isWebUIAllowDelete ,
150155 'file_base_path ' => $ this ->fileBasePath ,
151156 ]);
157+
158+ return new Response ($ content );
152159 }
153160
154161 public function createAction (Request $ request , string $ configName , string $ locale , string $ domain ): Response
@@ -177,9 +184,11 @@ public function createAction(Request $request, string $configName, string $local
177184 return new Response ($ e ->getMessage (), Response::HTTP_BAD_REQUEST );
178185 }
179186
180- return $ this ->render ('@Translation/WebUI/create.html.twig ' , [
187+ $ content = $ this -> twig ->render ('@Translation/WebUI/create.html.twig ' , [
181188 'message ' => $ message ,
182189 ]);
190+
191+ return new Response ($ content );
183192 }
184193
185194 public function editAction (Request $ request , string $ configName , string $ locale , string $ domain ): Response
0 commit comments