Create content type by code. New Form is empty
===

I am trying to connect a content type by code, (dont ask why), lol. The feature works fine, the new column is added fine to the views.

For some reason in the NEW or Edit form the new Field Source Name is not present. When I go to List Settings, Advanced, it says Manage Content Types= NO, but I set it to Yes on the code.

I am out of ideas.




    SPContentType sourceContentType = currentWeb.ContentTypes[SponsoringCommon.Constants.CONTENTTYPES_SOURCES_NAME];
                SPContentTypeId sourceContentTypeid = new SPContentTypeId(SponsoringCommon.Constants.CONTENTTYPES_SOURCE_ID);
                if (sourceContentType == null)
                {
                    sourceContentType = new SPContentType(sourceContentTypeid,
                                                            currentWeb.ContentTypes, 
                                                            SponsoringCommon.Constants.CONTENTTYPES_SOURCES_NAME);
                    currentWeb.ContentTypes.Add(sourceContentType);
                }
    
     string sourceFieldName = currentWeb.Fields.Add(SponsoringCommon.Constants.FIELDS_SOURCE_NAME, SPFieldType.Text, false);
                    SPField sourceField = currentWeb.Fields.GetFieldByInternalName(sourceFieldName);
                    sourceField.Group = "$Resources:SPNLSponsoring,Field_NationaleLoterijSponsoringColumns_Group";
                    schemaXmlWithResourceTokens = sourceField.SchemaXmlWithResourceTokens;
                    startIndex = schemaXmlWithResourceTokens.IndexOf("\"", schemaXmlWithResourceTokens.IndexOf("DisplayName=\"")) + 1;
                    endIndex = schemaXmlWithResourceTokens.IndexOf("\"", startIndex);
                    substringLength = endIndex - startIndex;
                    value = @"DisplayName=\" + schemaXmlWithResourceTokens.Substring(startIndex, substringLength);
                    schemaXmlWithResourceTokens = schemaXmlWithResourceTokens.Replace(value, @"DisplayName=\$Resources:SPNLSponsoring,Field_Source_Name");
                    sourceField.SchemaXml = schemaXmlWithResourceTokens;
                    sourceField.ShowInEditForm = true;
                    sourceField.ShowInNewForm = true;
                    sourceField.ShowInDisplayForm = true;
    
                    SPFieldLink fieldLinkSourceName = new SPFieldLink(sourceField);
                    sourceContentType.FieldLinks.Add(fieldLinkSourceName);
                    sourceContentType.Update(true);
    
                    sourceList.ContentTypesEnabled = true;
                    sourceList.ContentTypes.Add(sourceContentType);              
                    SPContentTypeCollection currentOrderSourceList = sourceList.ContentTypes;
                    List<SPContentType> resultSourceList = new List<SPContentType>();
                    foreach (SPContentType ct in currentOrderSourceList)
                    {
                        if (ct.Name.Contains(SponsoringCommon.Constants.CONTENTTYPES_SOURCES_NAME))
                        {
                            resultSourceList.Add(ct);
                        }
                    }
                    sourceList.RootFolder.UniqueContentTypeOrder = resultSourceList;
                    sourceList.RootFolder.Update();
                    currentWeb.Update();