nette / application

🏆 A full-stack component-based MVC kernel for PHP that helps you write powerful and modern web applications. Write less, have cleaner code and your work will bring you joy.
https://doc.nette.org/application
Other
412 stars 106 forks source link

Presenter::$onAfterSignal event #309

Open mabar opened 2 years ago

mabar commented 2 years ago

I am currently working on a Tracy panel which tracks submitted forms and shows errors from these forms.

This is useful for debugging manually rendered forms which don't render all form errors. e.g. datagrids

Problem is it is currently hooked via onStartup event. That works only for components that are created via createComponent*(), have all required parameters for creation available during startup and are not created manually - e.g. via $this['form'] = new Form(); in action*() method. It also changes order of code execution.

Having an onAfterSignal event would solve all of these issues and would also allow me to handle successfully submitted forms (which throw AbortException for redirect) and other signals

Current (bad) solution:

If you agree on proposed solution @dg I will write some tests for it.

dg commented 2 years ago

Seem legit.

For consistency, it might be a good idea to add $onSignal too.