+ /**
+ * Renders a view
+ *
+ * {@inheritdoc}
+ */
+ protected function render(string $view, array $parameters = [], Response $response = null): Response {
+ //Create response when null
+ $response ??= new Response();
+
+ //With empty head locale
+ if (empty($parameters['head']['locale'])) {
+ //Set head locale
+ $parameters['head']['locale'] = $this->locale;
+ }
+
+ //With empty head title and section
+ if (empty($parameters['head']['title']) && !empty($parameters['section'])) {
+ //Set head title
+ $parameters['head']['title'] = implode(' - ', [$parameters['title'], $parameters['section'], $parameters['head']['site']]);
+ //With empty head title
+ } elseif (empty($parameters['head']['title'])) {
+ //Set head title
+ $parameters['head']['title'] = implode(' - ', [$parameters['title'], $parameters['head']['site']]);
+ }
+
+ //Call twig render method
+ $content = $this->twig->render($view, $parameters);
+
+ //Invalidate OK response on invalid form
+ if (200 === $response->getStatusCode()) {
+ foreach ($parameters as $v) {
+ if ($v instanceof FormInterface && $v->isSubmitted() && !$v->isValid()) {
+ $response->setStatusCode(422);
+ break;
+ }
+ }
+ }
+
+ //Store content in response
+ $response->setContent($content);
+
+ //Return response
+ return $response;
+ }
+