nette / latte

☕ Latte: the safest & truly intuitive templates for PHP. Engine for those who want the most secure PHP sites.
https://latte.nette.org
Other
1.09k stars 107 forks source link

Make Engine->$probe event non-internal #319

Closed mabar closed 1 year ago

mabar commented 1 year ago

I am currently working on a Tracy panel which inspects all nette/application components on a page. This panel also includes functionality of LattePanel. It works well, but I have to use $probe event for that and it's not ideal, because it collides with original LattePanel and also needs internal $probe event.

Could we make $probe non-internal and also accept list of callbacks as other Nette events do? Thank you

Best would be to add support to both 3.0 and 2.11 branches so I could reliably support older Latte, but I could live without it.

image

dg commented 1 year ago

The probe variable was a temporary solution that I wanted to replace with Latte\Extension, but I forgot about it.

The template would be passed to Extension::beforeRender(), but now I've discovered that I have a stupid bug in the interface: beforeRender() method doesn't accept the Template, it accepts the Engine 🤦‍♂️

I'm considering fixing it even at the price of a BC break, as nearly no one is using Latte 3 yet…

mabar commented 1 year ago

Well, better do it now than later I guess

dg commented 1 year ago

okay, I tried to do it in master. Is this usable for you?

mabar commented 1 year ago

Yeah, it's fine, my version of probe is practically the same https://github.com/orisai/nette-application/blob/bc394c43189e84f26f2f6efef2ff5de71414b7c5/src/Inspector/Inspector.php#L40-L48

Thank you David