You got it. It has to be accessible for service work, to get to the wiring. The transformer was likely originally attached to the cover through the hole in the cover, and the attaching nut or setscrew backed off, letting the transformer dangle. The small wires coming off the other side(secondary) of the transformer should be low voltage, usually between 6 and 24 volts. Low voltage wiring falls under different rules than higher voltages.