/**
     * @param string $type
     * @return array
     */
    public function mixXMLFields($type)
    {
        $fieldArray = $this->fieldBuilder->getFieldArray();
        $realType   = XMLImportDataHandler::getAdjustedType($fieldArray, $type);

        XMLImportMonitor::log("Type : $type" . ($realType ? " ($realType)" : ''), 'info');

        if ($realType)
        {
            /* @type $availableRelatedContent array */
            $availableRelatedContent = $this->importINI->variable('XMLImportSettings', 'AvailableRelatedContent');
            $xmlFieldList            = array();

            /* @type $xmlFields XMLField[] */
            foreach ($fieldArray as $xmlFieldName => $xmlFields)
            {
                // Get first of the list
                $xmlField   = $xmlFields[0];
                $mapping    = XMLImportMapping::getByXMLName($realType, $xmlFieldName);

                if (!$mapping)
                {
                    $mediaType = $xmlField->getChildByName('media_type');

                    if ($mediaType && in_array($mediaType, $availableRelatedContent))
                        $mapping = XMLImportMapping::getByType($mediaType);
                }
                if ($mapping !== false)
                {
                    foreach ($xmlFields as $field)
                    {
                        $field->setParentType($realType);
                        $field->internalFieldName = $mapping['internalField'];
                    }

                    if ($mapping['multiValues'])
                        $xmlFieldList[$mapping['internalField']] = $xmlFields;
                    else
                    {
                        if (count($xmlFields) > 1)
                            XMLImportMonitor::log("This field shouldn't have multiple Values : $type.$xmlFieldName - first value used (other are ignored)", 'warning');

                        $xmlFieldList[$mapping['internalField']] = $xmlField;
                    }
                }
                else
                    XMLImportMonitor::log("Unknown field : $realType.$xmlFieldName - ignored", 'notice');
            }

            return $xmlFieldList;
        }
        else
        {
            XMLImportMonitor::log('Main type unknown - field ignored', 'warning');
            return false;
        }
    }