In case of MM relation $currentDatabaseValueArray never holds a valid
relation value, because it is everytime the amount of relations. So
it never makes sense to use this value to determine selected items.
That static values do not work, is also described in TYPO3 documentation
of MM TCA option in the note box:
"Using MM relations you can ONLY store real relations for foreign tables
in the list - no additional string values or non-record values."
Solution:
Do not respect $currentDatabaseValueArray as real values in case of MM
relation.
Also done:
Rename $staticValues into $itemArray, because there are no static values
handed over anymore, but the whole item array for this field.
See \TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectItems line 91