protected virtual ContentType.ContentTypeProperty AddContentTypeProperty(ContentType contentType, PropertyInfo propertyInfo) { //TODO: Différencier les Strong Relation des Relation (weak)... Ex. AddAggregationProperty (avec un attribut?) if (propertyInfo.PropertyType.IsContentTranslationVersion()) { return(contentType.AddRelationProperty(GetContentTypePropertyNameFromPropertyInfo(propertyInfo), GetContentTypePropertyIsCultureInvariantFromPropertyInfo(propertyInfo))); } if (propertyInfo.PropertyType.IsGenericList() && propertyInfo.PropertyType.GenericTypeArguments[0].IsContentTranslationVersion()) { return(contentType.AddRelationsProperty(GetContentTypePropertyNameFromPropertyInfo(propertyInfo), GetContentTypePropertyIsCultureInvariantFromPropertyInfo(propertyInfo))); } return(contentType.AddProperty(GetContentTypePropertyNameFromPropertyInfo(propertyInfo), GetContentTypePropertyDefaultValueFromPropertyInfo(propertyInfo), GetContentTypePropertyIsCultureInvariantFromPropertyInfo(propertyInfo))); }
private static void AddEditableText(ContentType contentType, string title, string name, int sortOrder, string formatString, string description, int maxLength, bool multiline) { ReactiveTextBoxEditorAttribute editor = new ReactiveTextBoxEditorAttribute(title, sortOrder, formatString) { Name = name, ContainerName = "SEO", MaxLength = maxLength, Description = description, Shared = false, PropertyType = typeof(string) }; if (multiline) editor.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine; contentType.Add(editor); contentType.AddProperty(new ContentPropertyAttribute(typeof(StringProperty), title, sortOrder) { Name = name, Description = description, EditorContainerName = "SEO", Shared = false }); }