Commit 14027d2
authored
docs: place template-override settings inside preUserFunc. (#845)
## Summary
The current template-override documentation places
`settings.templateRootPaths` as a **sibling** of `preUserFunc` under
`lib.parseFunc_RTE.tags.img`, e.g. (from
`Documentation/Examples/Template-Overrides.rst`):
```typoscript
lib.parseFunc_RTE.tags.img {
settings.templateRootPaths {
10 = EXT:my_sitepackage/Resources/Private/Templates/
}
}
```
That placement has no effect. TYPO3's
`ContentObjectRenderer::stdWrap_preUserFunc()` only forwards
`$conf['preUserFunc.']` to the callable:
```php
// typo3/cms-frontend Classes/ContentObject/ContentObjectRenderer.php
public function stdWrap_preUserFunc($content = '', $conf = [])
{
return $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'] ?? [], $content);
}
```
So anything under `tags.img.settings.*` is never seen by
`ImageRenderingAdapter::renderImageAttributes()`, and therefore never
reaches `ImageRenderingService::buildTemplatePaths()`. As written today,
the documented override silently does nothing — integrators end up with
the default extension templates regardless of what `templateRootPaths`
they set.
The correct placement is **inside** `preUserFunc.`:
```typoscript
lib.parseFunc_RTE.tags.img.preUserFunc {
settings.templateRootPaths {
10 = EXT:my_sitepackage/Resources/Private/Templates/
}
}
```
The same applies to `externalBlocks.figure.stdWrap.preUserFunc` for
figure-wrapped (captioned) images, which is rendered via
`renderFigure()`.
## Empirical confirmation
I hit this while overriding templates in my own site package: with
`settings.*` at the documented `tags.img` level my custom templates were
ignored. After moving the block into `preUserFunc.settings.*`, the
custom templates loaded immediately. ImageRenderingService's
`buildTemplatePaths()` already handles either
`$config['settings.']['templateRootPaths.']` or
`$config['templateRootPaths.']` directly, so the only change needed is
in the docs.
## Changes
Three places carried the same incorrect example; this PR fixes all
three:
- `Documentation/Examples/Template-Overrides.rst` — the canonical
override example, plus the accompanying note about
`externalBlocks.figure.stdWrap`. The figure-side example is now spelled
out explicitly so users don't have to guess where to put it.
- `Resources/AGENTS.md` — short architectural note that mirrored the bad
example.
- `Configuration/TypoScript/ImageRendering/setup.typoscript` — inline
comment block that shipped with the extension.
Each fix moves `settings.*` under `preUserFunc.` and adds a one-line
explanation of *why* (`stdWrap_preUserFunc` only forwards its own
sub-array), so future readers don't have to re-trace the call.
## Test plan
- [x] Pre-commit hooks pass (`make lint`) — docs-only change, no PHP/JS
edits.
- [x] Unit tests pass (`composer ci:test:php:unit`) — docs-only change.
- [x] Manual testing performed — verified that moving
`settings.templateRootPaths` under `preUserFunc.` is the placement that
actually loads custom templates on a real TYPO3 v13.10 install.
## Related issues
<!-- No matching open issue found; happy to file one if the maintainers
prefer that flow. -->3 files changed
Lines changed: 84 additions & 32 deletions
File tree
- Configuration/TypoScript/ImageRendering
- Documentation/Examples
- Resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
38 | 45 | | |
39 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
40 | 51 | | |
41 | 52 | | |
42 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
194 | 201 | | |
195 | 202 | | |
196 | 203 | | |
197 | 204 | | |
198 | | - | |
| 205 | + | |
199 | 206 | | |
200 | | - | |
201 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
202 | 217 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
208 | 234 | | |
209 | 235 | | |
210 | 236 | | |
211 | 237 | | |
212 | 238 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
221 | 244 | | |
222 | 245 | | |
223 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
75 | 83 | | |
76 | | - | |
77 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
78 | 96 | | |
79 | 97 | | |
80 | 98 | | |
| |||
0 commit comments