Score:0

Use HTTP_REFERER within a twig template

my flag

I have a FAQ page with five nested bootstrap 5 accordions and I need to have one accordion item or another open depending on the page the user is coming from.

I tried using this:

{% set previousURL = app.request.headers.get('referer') %}

but I get nothing.

Using Drupal 9.

id flag
`app` is something the Symfony Twig Bundle adds to Twig templates which does not exist in Drupal. Did you discover this in a Symfony Framework tutorial?
cn flag
I would solve this using javascript instead of twig.
Score:-1
id flag

To do this you must either:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.