Skip to content

Commit 1e24d63

Browse files
committed
Add introductory sentence.
Reorganize and rewrite content for better flow and Plone version context. Fix grammar, spelling, and typos.
1 parent cfb2fae commit 1e24d63

File tree

1 file changed

+34
-23
lines changed

1 file changed

+34
-23
lines changed

docs/classic-ui/theming/diazo.md

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -178,55 +178,66 @@ Sometimes it is easier to override the corresponding template in Plone, build th
178178
The size of the {file}`rules.xml` file and the number of rules it contains can negatively impact the performance of your site.
179179

180180

181-
### Disabling Diazo for AJAX requests
181+
### Disable Diazo for AJAX requests
182182

183-
You can disable AJAX requests for Diazo themes with the help of the `ajax_load` request parameter.
184-
This parameter is used in some places throughout Plone to indicate AJAX requests, which normally should not be transformced by Diazo.
185-
Also, in Plone 6.2 the `ajax_load` parameter will [automatically be added to the request](https://github.com/plone/Products.CMFPlone/pull/4169) for most AJAX requests.
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.
186185

187-
```{note}
188-
Note: For Plone versions before 6.2, add the `ajax_load` query string parameter for your AJAX requests, e.g. `?ajax_load=1`.
189-
For versions 6.2 and later, this is done automatically for most AJAX requests.
186+
To prevent this transformation, disable AJAX requests for Diazo themes by using the `ajax_load` HTTP request parameter.
187+
`ajax_load` is used in Plone to indicate AJAX requests.
188+
When added to the query string, `ajax_load=1` disables a full page rendering, whereas `ajax_load=0` enables it.
189+
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).
190195
```
196+
````
197+
198+
Manually add the HTTP request parameter and its value as follows.
191199

192-
Firs you need a theme-parameter in your {file}`manifest.cfg` file.
200+
Add a theme parameter to your {file}`manifest.cfg` file.
193201

194202
```cfg
195203
[theme:parameters]
196204
ajax_load = python:request.get('ajax_load')
197205
```
198206

199-
Then you can disable Diazo for AJAX requests in your {file}`rules.xml` file:
207+
Then disable Diazo for AJAX requests in your {file}`rules.xml` file.
200208

201209
```xml
202-
<notheme if="$ajax_load" /><!-- don't theme ajax requests -->
210+
<notheme if="$ajax_load" /><!-- don't theme ajax requests -->
203211
```
204212

205-
After that you would need to restart you instance and reload your theme.
206-
One way is to select another theme and then switch back to your own theme in the theming control panel.
207-
For a programmatical way, check [this pull request in plonetheme.barceloneta](https://github.com/plone/plonetheme.barceloneta/pull/404).
213+
Choose any method to load this change in your theme.
214+
215+
- Restart your instance.
216+
- In the {guilabel}`Theming` control panel, select another theme, then switch back to your own theme.
217+
- For a programmatical way, see [(Re)Introduce the ajax_load theme parameter and skip diazo theming, if set. `plone/plonetheme.barceloneta` #404](https://github.com/plone/plonetheme.barceloneta/pull/404).
218+
208219

220+
### Completely disable Diazo
209221

210-
### Completly disable Diazo
222+
You can fully disable Diazo for your theme.
211223

212-
You might want to not use Diazo for your theme and fully disable it.
213-
This can be done by setting the `X-Theme-Disabled` http header before Diazo gets active, e.g. in a `IBeforeTraverseEvent` event subscriber.
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.
214225

215-
In this example we add an event subscriber in e.g. a {file}`subscribers.py` file in a add-on package:
226+
Add an event subscriber in a {file}`subscribers.py` file in an add-on package.
216227

217228
```python
218229
def disable_diazo(obj, event):
219230
event.request.response.setHeader("X-Theme-Disabled", True)
220231
```
221232

222-
And then it needs to be registered in a {file}`configure.zcml` file:
233+
Then register it in a {file}`configure.zcml` file.
223234

224235
```xml
225-
<subscriber
226-
for="*
227-
zope.traversing.interfaces.IBeforeTraverseEvent"
228-
handler=".subscribers.disable_diazo"
229-
/>
236+
<subscriber
237+
for="*
238+
zope.traversing.interfaces.IBeforeTraverseEvent"
239+
handler=".subscribers.disable_diazo"
240+
/>
230241
```
231242

232243
Now Diazo should be disabled for all requests.

0 commit comments

Comments
 (0)