コード例 #1
0
 // Umbraco.Code.MapAll -CreateDate -UpdateDate -ListViewEditorName -Errors -LockedCompositeContentTypes
 private void MapTypeToDisplayBase(ContentTypeSave source, ContentTypeCompositionDisplay target)
 {
     target.Alias                 = source.Alias;
     target.AllowAsRoot           = source.AllowAsRoot;
     target.AllowedContentTypes   = source.AllowedContentTypes;
     target.Blueprints            = source.Blueprints;
     target.CompositeContentTypes = source.CompositeContentTypes;
     target.Description           = source.Description;
     target.Icon         = source.Icon;
     target.IconFilePath = target.IconIsClass
         ? string.Empty
         : $"{_globalSettings.GetBackOfficePath(_hostingEnvironment).EnsureEndsWith("/")}images/umbraco/{source.Icon}";
     target.Id                = source.Id;
     target.IsContainer       = source.IsContainer;
     target.IsElement         = source.IsElement;
     target.Key               = source.Key;
     target.Name              = source.Name;
     target.ParentId          = source.ParentId;
     target.Path              = source.Path;
     target.Thumbnail         = source.Thumbnail;
     target.ThumbnailFilePath = target.ThumbnailIsClass
         ? string.Empty
         : _hostingEnvironment.ToAbsolute("~/umbraco/images/thumbnails/" + source.Thumbnail);
     target.Trashed = source.Trashed;
     target.Udi     = source.Udi;
 }
コード例 #2
0
 // Umbraco.Code.MapAll -CreateDate -UpdateDate -ListViewEditorName -Errors -LockedCompositeContentTypes
 private void MapTypeToDisplayBase(ContentTypeSave source, ContentTypeCompositionDisplay target)
 {
     target.Alias                 = source.Alias;
     target.AllowAsRoot           = source.AllowAsRoot;
     target.AllowedContentTypes   = source.AllowedContentTypes;
     target.Blueprints            = source.Blueprints;
     target.CompositeContentTypes = source.CompositeContentTypes;
     target.Description           = source.Description;
     target.Icon        = source.Icon;
     target.Id          = source.Id;
     target.IsContainer = source.IsContainer;
     target.IsElement   = source.IsElement;
     target.Key         = source.Key;
     target.Name        = source.Name;
     target.ParentId    = source.ParentId;
     target.Path        = source.Path;
     target.Thumbnail   = source.Thumbnail;
     target.Trashed     = source.Trashed;
     target.Udi         = source.Udi;
 }
コード例 #3
0
        private static void MapComposition(ContentTypeSave source, IContentTypeComposition target, Func <string, IContentTypeComposition> getContentType)
        {
            var current  = target.CompositionAliases().ToArray();
            var proposed = source.CompositeContentTypes;

            var remove = current.Where(x => !proposed.Contains(x));
            var add    = proposed.Where(x => !current.Contains(x));

            foreach (var alias in remove)
            {
                target.RemoveContentType(alias);
            }

            foreach (var alias in add)
            {
                // TODO: Remove N+1 lookup
                var contentType = getContentType(alias);
                if (contentType != null)
                {
                    target.AddContentType(contentType);
                }
            }
        }