Resolve #3531836 "Move hook out of .module file"
Closes #3531836
Move hook out of .module file. Also make it backward compatible for Drupal 10.1. Use dependency injection and constructor property promotion on FormHooks.php. Use StringTranslationTrait instead of globa t function in FormHooks.php.