New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace $GLOBALS['objPage']
with the page finder
#7014
base: 5.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the two remaining places also used the PageFinder
, we'd have a central place to adjust the code if we ever need to.
@@ -76,17 +76,6 @@ private function getPageModel(Request $request): PageModel|null | |||
|
|||
$pageModel = $request->attributes->get('pageModel'); | |||
|
|||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also use the PageFinder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don‘t think so, because $pageModel
can be an integer here, too. @aschempp /cc
$clientCache = 0; | ||
$pageId = null; | ||
|
||
$request = $this->requestStack->getCurrentRequest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also use the PageFinder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The service is not internal, so we cannot add a dependency. It also does not make sense to inject both the request stack and the page finder, because both provide the page model.
$GLOBALS['objPage']
in the non-legacy code$GLOBALS['objPage']
with the page finder
a16eb37
to
ee40e51
Compare
ee40e51
to
17c08b1
Compare
TODO
We sometimes override the global page object to replace insert tags, e.g. here:
contao/core-bundle/contao/dca/tl_page.php
Lines 769 to 782 in d23230e
In these cases, we have to push a new request to the request stack instead.