Added "$object" parameter to $formfile->showdocuments call in order to use the $object reference on the showDocuments hook called inside showdocuments function. Otherwise, the hook is called with a null reference.