From 5bcaf58a7608ad467dffc3be35721d9e3286b4c1 Mon Sep 17 00:00:00 2001
From: Tim <5579551+Timherlaud@users.noreply.github.com>
Date: Wed, 22 May 2024 16:31:48 +0200
Subject: [PATCH] 19909 [FrameworkBundle] Add support for setting headers
---
templates.rst | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/templates.rst b/templates.rst
index b6ae333cee1..d1c714d4225 100644
--- a/templates.rst
+++ b/templates.rst
@@ -705,6 +705,11 @@ provided by Symfony:
site_name: 'ACME'
theme: 'dark'
+ # optionally you can define HTTP headers to add to the response
+ headers:
+ Content-Type: 'text/html'
+ foo: 'bar'
+
.. code-block:: xml
@@ -734,6 +739,11 @@ provided by Symfony:
ACME
dark
+
+
+
+ text/html
+
@@ -764,11 +774,20 @@ provided by Symfony:
'context' => [
'site_name' => 'ACME',
'theme' => 'dark',
+ ],
+
+ // optionally you can define HTTP headers to add to the response
+ 'headers' => [
+ 'Content-Type' => 'text/html',
]
])
;
};
+.. versionadded:: 7.2
+
+ The ``headers`` option was introduced in Symfony 7.2.
+
Checking if a Template Exists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~