Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
As the title, I'm having issue that, here's my code:
protected bool AddPropertyType(IContentType contentType, IDataTypeDefinition dataType, string alias, string name, string description, string TabName, int sortOrder = 0, bool mandatory = false) { if (!contentType.PropertyTypeExists(alias)) { contentType.AddPropertyType( new PropertyType(dataType, alias) { Name = name, Description = description, Mandatory = mandatory, PropertyEditorAlias = dataType.PropertyEditorAlias, SortOrder = sortOrder }, TabName); return true; } return false; } protected void ReOrderPropertyTypes(IContentType contentType, string groupName, string currentPropertyTypeAlias, int currentSortOrder) { var group = contentType.PropertyGroups[groupName]; if(group != null) { var otherPropertyTypes = group.PropertyTypes.Where(e => e.SortOrder >= currentSortOrder && e.Alias != currentPropertyTypeAlias) .OrderBy(e=>e.SortOrder); foreach(var item in otherPropertyTypes) { item.SortOrder = item.SortOrder + 1; } } } AddPropertyType(abstractOpenGraphContentType, label, "nOTE", "NOTE", "", "OpenGraph", 0)) ReOrderPropertyTypes(abstractOpenGraphContentType, "OpenGraph", "nOTE", 0); ApplicationContext.Current.Services.ContentTypeService.Save(globalConfigContentType);
The code works well but the backoffice UI didn't work as expected, the new field (named "NOTE") displays in a random position, not on the top of "OpenGraph" tab.
Does anyone have any recommendations to make it work?
Best regards, Nick
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Issue with adding new property to an existing document type and put it on top of other properties (in the same tab)
Hi,
As the title, I'm having issue that, here's my code:
The code works well but the backoffice UI didn't work as expected, the new field (named "NOTE") displays in a random position, not on the top of "OpenGraph" tab.
Does anyone have any recommendations to make it work?
Best regards, Nick
is working on a reply...