I generate a sample Class form (and routing) with the drupal console.
Then, I have my class with some defaults generated methods ; getFormId, buildForm...
When the user go to the url path defined in the routing file, the buildForm method is called for build the the form. I want call another function for check some datas before the buildForm method :
I function like :
function a_check_function_or_method_before_buildForm(...){
// - Check some datas
// - If all is ok, the buildForm can be called
// - Else, if the custom function detect an error, the buildForm isn't called and the user is redirected to an error page
}
Is it possible to do that ? how can I do that ?
Thank you =)