Skip to content

Commit 20468d5

Browse files
committed
Document disabling Diazo via a registry setting instead the traverser. The automatic ajax_load setting didn't make it into Plone (but an alternative which doesn't influence theming).
1 parent 1e24d63 commit 20468d5

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

docs/classic-ui/theming/diazo.md

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,16 @@ The size of the {file}`rules.xml` file and the number of rules it contains can n
180180

181181
### Disable Diazo for AJAX requests
182182

183-
After sending an AJAX request from the client to Plone, Plone returns a JSON response.
184-
Normally, this response should not get transformed by Diazo themes, and is usually handled in client-side JavaScript.
183+
When sending an AJAX request to normal browser views in Plone, Plone will respond with an HTML page which normally is also transformed via the Diazo theming engine.
184+
In some cases this is an unnecessary overhead, if you only want to inject a small snippet of HTML into the page.
185185

186186
To prevent this transformation, disable AJAX requests for Diazo themes by using the `ajax_load` HTTP request parameter.
187187
`ajax_load` is used in Plone to indicate AJAX requests.
188188
When added to the query string, `ajax_load=1` disables a full page rendering, whereas `ajax_load=0` enables it.
189189

190-
````{versionadded} Plone 6.2
191-
In Plone 6.2, the query parameter and its value `ajax_load=1` are automatically added to most AJAX requests by default.
192-
193-
```{seealso}
194-
See the related pull request [Automatically set the ajax_load request parameter, `plone/Products.CMFPlone` #4169](https://github.com/plone/Products.CMFPlone/pull/4169).
195-
```
190+
````{versionadded} plonetheme.barceloneta 3.3.0
191+
In Plone's standard theme plonetheme.barceloneta 3.3.0 the `ajax_load` theme parameter to disable Diazo was added.
192+
If you use this theme, the next steps are obsolete.
196193
````
197194

198195
Manually add the HTTP request parameter and its value as follows.
@@ -219,25 +216,4 @@ Choose any method to load this change in your theme.
219216

220217
### Completely disable Diazo
221218

222-
You can fully disable Diazo for your theme.
223-
224-
Set the `X-Theme-Disabled` HTTP header before Diazo gets active, such as in an `IBeforeTraverseEvent` event subscriber, as shown in the following example.
225-
226-
Add an event subscriber in a {file}`subscribers.py` file in an add-on package.
227-
228-
```python
229-
def disable_diazo(obj, event):
230-
event.request.response.setHeader("X-Theme-Disabled", True)
231-
```
232-
233-
Then register it in a {file}`configure.zcml` file.
234-
235-
```xml
236-
<subscriber
237-
for="*
238-
zope.traversing.interfaces.IBeforeTraverseEvent"
239-
handler=".subscribers.disable_diazo"
240-
/>
241-
```
242-
243-
Now Diazo should be disabled for all requests.
219+
You can fully disable Diazo and plone.app.theming based themes by setting the `plone.app.theming.interfaces.IThemeSettings.enabled` registry entry to `False`.

0 commit comments

Comments
 (0)