-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add Twig functions for cmf_document_path and cmf_document_url #90
Comments
i think route generation should always work outside the current domain context, and we need a separate generator for that, as discussed in symfony-cmf/symfony-cmf#182 i think it makes sense to have these functions, still go through the normal chain router when generating but catch all exceptions and log them on a configurable level. maybe you want to know even in prod so you can fix things occasionally. for dev, if you want to get fancy we can also (later) add a feature to the debug toolbar. the support for uuid + path to make editing links more stable should just go into the cmf route generator and not be specific to these twig functions. |
@benglass do you want to do a PR for those functions? |
btw, this should be on RoutingBundle as here in the component we don't know about twig. |
Moved to symfony-cmf/routing-bundle#239 |
Currently there is support for generating URLs for cmf documents using the symfony path and url twig functions but it would be nice to have a dedicated function that only generates CMF-based routes for the following reasons:
There is discussion happening around this here symfony-cmf/routing-bundle#178 but there is nothing stopping us from creating these functions using the current route generator rather than the chain route generator and also implementing the don't throw exceptions approach.
How should exceptions be handled? You could have a $throw boolean method in the constructor for the twig extension that is set based on the kernel.debug parameter (so it would throw exceptions in dev but not production. This might not be ideal because it would make it hard to work on a page that was throwing exceptions. Perhaps it could just log these exceptions in dev as critical errors.
Also not sure if this should be in Routing or RoutingBundle. Its not symfony specific so I put it here.
The text was updated successfully, but these errors were encountered: