[BUGFIX] Fix error in flexform hook

Resolves: #51961
Change-Id: I098f059ce3eda55db7657c0ce611cb97e7b8c1fa
Reviewed-on: https://review.typo3.org/24237
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer