File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace TYPO3 \CMS \VisualEditor \Middleware ;
6+
7+ use Psr \Http \Message \ResponseInterface ;
8+ use Psr \Http \Message \ServerRequestInterface ;
9+ use Psr \Http \Server \MiddlewareInterface ;
10+ use Psr \Http \Server \RequestHandlerInterface ;
11+ use TYPO3 \CMS \Frontend \Cache \CacheInstruction ;
12+
13+ readonly class DisableCacheInEditModeMiddleware implements MiddlewareInterface
14+ {
15+ public function process (ServerRequestInterface $ request , RequestHandlerInterface $ handler ): ResponseInterface
16+ {
17+ $ params = $ request ->getQueryParams ();
18+ if (isset ($ params ['editMode ' ])) {
19+ $ cacheInstruction = $ request ->getAttribute ('frontend.cache.instruction ' , new CacheInstruction ());
20+ $ cacheInstruction ->disableCache ('EXT:visual_editor: The editMode parameter forced the cache to be disabled. ' );
21+ $ request = $ request ->withAttribute ('frontend.cache.instruction ' , $ cacheInstruction );
22+ }
23+
24+ return $ handler ->handle ($ request );
25+ }
26+ }
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5+ use TYPO3 \CMS \VisualEditor \Middleware \DisableCacheInEditModeMiddleware ;
56use TYPO3 \CMS \VisualEditor \Middleware \PersistenceMiddleware ;
67
78return [
1516 'typo3/cms-adminpanel/sql-logging ' ,
1617 ],
1718 ],
19+ 'typo3/cms-visual-editor/disable-cache-in-edit-mode-middleware ' => [
20+ 'target ' => DisableCacheInEditModeMiddleware::class,
21+ 'before ' => [
22+ 'typo3/cms-frontend/page-argument-validator ' ,
23+ 'typo3/cms-frontend/prepare-tsfe-rendering ' ,
24+ 'typo3/cms-frontend/tsfe ' , // TODO typo3/cms-frontend/tsfe can be dropped if TYPO3 14 is lowest supported version
25+ 'typo3/cms-frontend/page-resolver ' ,
26+ 'typo3/cms-adminpanel/sql-logging ' ,
27+ ],
28+ ],
1829 ],
1930];
Original file line number Diff line number Diff line change 3131 "pluswerk/grumphp-config" : " ^10.2.7" ,
3232 "saschaegerer/phpstan-typo3" : " ^2.1.1 || ^3.0.1" ,
3333 "ssch/typo3-rector" : " ^3.14.1" ,
34- "typo3/cms-install" : " ^13.4.28 || ^14.3.0 " ,
35- "typo3/cms-workspaces" : " ^13.4.28 || ^14.3.0 " ,
34+ "typo3/cms-install" : " ^13.4.28 || ^14.3.2 " ,
35+ "typo3/cms-workspaces" : " ^13.4.28 || ^14.3.2 " ,
3636 "typo3/testing-framework" : " ^9.5.0" ,
3737 "typo3fluid/fluid" : " ^4.6.1 || ^5.3.1"
3838 },
Original file line number Diff line number Diff line change 1515if (!class_exists (ModifyRenderedContentAreaEvent::class)) {
1616 class_alias (V13_RenderContentAreaEvent::class, ModifyRenderedContentAreaEvent::class);
1717}
18-
19- // exclude editMode from chash: If the parameter is present, the middleware already stops the normal rendering.
20- $ GLOBALS ['TYPO3_CONF_VARS ' ]['FE ' ]['cacheHash ' ]['excludedParameters ' ] ??= [];
21- $ GLOBALS ['TYPO3_CONF_VARS ' ]['FE ' ]['cacheHash ' ]['excludedParameters ' ][] = 'editMode ' ;
You can’t perform that action at this time.
0 commit comments