protected function detectFirstFlexTypeFieldInTableFromPossibilities($table, $fields) { foreach ($fields as $fieldName) { if ('flex' === $GLOBALS['TCA'][$table]['columns'][$fieldName]['config']['type']) { return $fieldName; } } return NULL; }