Skip to content

Commit 3ead4e2

Browse files
committed
Disabling Diazo: Document how to disable diazo for AJAX requests and completly.
1 parent 6100600 commit 3ead4e2

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

docs/classic-ui/theming/diazo.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,44 @@ For instance, you may need to put together the main menu, the language change, a
176176
Sometimes it is easier to override the corresponding template in Plone, build the new HTML structure there, and replace one thing in the {file}`rules.xml` file than trying to write complex Diazo rules or writing XSLT.
177177

178178
The size of the {file}`rules.xml` file and the number of rules it contains can negatively impact the performance of your site.
179+
180+
181+
### Disable Diazo for AJAX requests
182+
183+
When sending an AJAX request to normal browser views in Plone, Plone prepares a response as an HTML page, then normally transforms it via the Diazo theming engine.
184+
In some cases this is unnecessary overhead, such as when you want to inject a small snippet of HTML only into the page.
185+
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} plonetheme.barceloneta 3.3.0
191+
In Plone Classic UI's standard theme, `plonetheme.barceloneta` version 3.3.0, the `ajax_load` theme parameter to disable Diazo was added.
192+
If you use this theme version 3.3.0 or later, then the next steps are obsolete.
193+
```
194+
195+
Manually add the HTTP request parameter and its value as follows.
196+
197+
Add a theme parameter to your {file}`manifest.cfg` file.
198+
199+
```cfg
200+
[theme:parameters]
201+
ajax_load = python:request.get('ajax_load')
202+
```
203+
204+
Then disable Diazo for AJAX requests in your {file}`rules.xml` file.
205+
206+
```xml
207+
<notheme if="$ajax_load" /><!-- don't theme ajax requests -->
208+
```
209+
210+
Choose any method to load this change in your theme.
211+
212+
- Restart your instance.
213+
- In the {guilabel}`Theming` control panel, select another theme, then switch back to your own theme.
214+
- For a programmatic 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).
215+
216+
217+
### Completely disable Diazo
218+
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)