1

I am unable to get a result back from app.request.attributes.get('_route'). What could cause this. I have tried similar variable and still get no response.

2

Because of Drupal's granular caching, it is not possible to make the global request object available in templates (at least by default); if a template was used on multiple pages, it would be cached with the data from one page and have incorrect information on any others.

If you require the request information in a particular template, you will need to add a preprocess hook to add the additional variable, and ensure that you add the correct cache tags.

To see what variables are available within a particular template, use {{ dump() }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.