Skip to content
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

Merged
merged 8 commits into from
Nov 10, 2024
Merged

Document content routing #1457

merged 8 commits into from
Nov 10, 2024

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Nov 3, 2024

Implements #1298

@fritzmg fritzmg added this to the 5.3 milestone Nov 3, 2024
@fritzmg fritzmg self-assigned this Nov 3, 2024
@fritzmg fritzmg linked an issue Nov 3, 2024 that may be closed by this pull request
@fritzmg fritzmg requested a review from aschempp November 3, 2024 18:13
docs/dev/framework/routing/content-routing.md Outdated Show resolved Hide resolved
docs/dev/framework/routing/content-routing.md Outdated Show resolved Hide resolved
docs/dev/framework/routing/content-routing.md Show resolved Hide resolved
@fritzmg fritzmg requested a review from Toflar November 4, 2024 16:04
docs/dev/framework/routing/content-routing.md Outdated Show resolved Hide resolved
docs/dev/framework/routing/content-routing.md Outdated Show resolved Hide resolved
docs/dev/framework/routing/content-routing.md Outdated Show resolved Hide resolved
docs/dev/framework/routing/content-routing.md Show resolved Hide resolved
docs/dev/framework/routing/content-routing.md Show resolved Hide resolved
Comment on lines +269 to +277
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');
Copy link
Member

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.

Copy link
Contributor Author

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.

docs/dev/reference/services.md Outdated Show resolved Hide resolved
@fritzmg fritzmg requested a review from aschempp November 5, 2024 09:52
@fritzmg
Copy link
Contributor Author

fritzmg commented Nov 10, 2024

Merging, as #1457 (comment) is just a detail that can be changed later.

@fritzmg fritzmg merged commit 15ba045 into main Nov 10, 2024
@fritzmg fritzmg deleted the content-routing branch November 10, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content URL generator
3 participants