Last modified: 2013-09-30 11:45:54 UTC
HTMLForm's trySubmit() calls the client-supplied onSubmit() callback: call_user_func( $callback, $data, $this ); so the second parameter to the callback is the HTMLForm object. This doesn't seem to be documented anywhere. But when you subclass FormSpecialPage, it declares the form handler as abstract public function onSubmit( array $data ); so you can't access this second parameter. I need access to the form for a demo program because some of the controls on the form affect its display. If I change the function declaration in SpecialPage.php to abstract public function onSubmit( array $data, $form ); then my program can access the form object, but this breaks all the other pages that subclass FormSpecialPage. I dunno if there's some PHP foo to let children inspect the hidden second parameter, or some way not to break the API.
Workaround: FormSpecialPage subclasses can use PHP's func_get_args() in their submit callback function to reveal the second parameter missing from the abstract declaration.