0

I'm aware that one can add parameters for the esi request like {{ render_esi('bundle:controller:action', {foo: 'bar'}) (would add the parameter foo with the value bar to the fragment uri).

My task requires setting this parameter dynamically from outside the template (at the moment the uri is generated).

I could not find an event that would be called as the uri is generated. Google did also not help solving this for me.

Basically what I want is to call {{ render_esi('bundle:controller:action') }} and it to result in an esi fragment uri containing the parameter foo=bar (added using some service?).

Is there a nice solution for this issue (without overwriting the fragment generators used by symfony that is)?

EDIT:

The parameter is not used by any of the controllers and is more or less required on a global scale as a request-listener will check the parameter and adjust a service with additional information. The listener will remove the parameter afterwards.

Catmzero
  • 113
  • 7
  • Have you tried attaching to the kernel with an event listener and checking whether it's an esi request to modify it? – Mike Doe Mar 07 '18 at 11:18
  • Once I am inside the esi request itself, I will not have any knowledge about the previous state. That's basically what I need the parameter for. – Catmzero Mar 07 '18 at 11:20

0 Answers0