-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
Document content routing #1457
Document content routing #1457
Conversation
if (!$request = $this->requestStack->getCurrentRequest()) { | ||
return null; | ||
} | ||
|
||
/** | ||
* This is a simplification for this example. We simply look for the first "foobar_reader" page type in this | ||
* website and assume that this is the correct page for which we want to generate the detail URL of our record. | ||
*/ | ||
$foobarPage = $this->pageFinder->findFirstPageOfTypeForRequest($request, 'foobar_reader'); |
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 would simplify this e.g. by using a property in $content
as the ID of the target page, removing the complexity of request and 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.
That would make the example more complex actually as you would then have to define the reader page somewhere. Either per record (which would be silly) or in a parent record (which this example does not use, i.e. it does not use mode 4).
This is actually how I would implement it in the new contao/blog-bundle
- you don't have to define a redirect page in the blog archive anymore. If you don't, the system will just look for the first reader page in the page tree. This simplifies the usage.
Co-authored-by: Andreas Schempp <[email protected]>
Merging, as #1457 (comment) is just a detail that can be changed later. |
Implements #1298