Preview tokens 5: Version-based rendering #6825
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚨 Merge first
VersionId::render()
#6824Description
Summary of changes
$page->render()
is now responsible to choose the correct version to render.Users can at any time pass a custom version ID that will always be used if passed. Otherwise the version ID is auto-detected.
If a render version is already set globally, this is the first detection priority. This can be relevant if a template calls
$somePage->render()
of another page. By using the global render version ID, that rendered version will match the one of the "outer" page.Otherwise the version ID will be taken from the request. In this PR this only re-implements the draft tokens.
Reasoning
Additional context
TODO
additions to the tests.Changelog
Enhancements
$page->render()
with the new$versionId
parameter.Refactoring (since alphas)
App
class closer to the action in$page->render()
Docs
We could document the new
$versionId
argument to$page->render()
. But I don't think we already have a place in the guide or cookbook that uses$page->render()
, at least I couldn't find one.Ready?
For review team
Add lab and/or sandbox examples (wherever helpful)