Skip to content

Latest commit

 

History

History
75 lines (64 loc) · 1.76 KB

custom-content-in-episerver-navigation.md

File metadata and controls

75 lines (64 loc) · 1.76 KB

Custom Content In Episerver Navigation

Descriptor

[ServiceConfiguration(typeof(IContentRepositoryDescriptor))]
    public class CommentsPaneDescriptor : ContentRepositoryDescriptorBase
    {
        public static string RepositoryKey { get { return "commets"; } }

        public override string Key { get { return RepositoryKey; } }

        public override string Name { get { return "Comments"; } }

        public override IEnumerable<Type> ContainedTypes
        {
            get
            {
                return new[]
                {
                    typeof(ContentFolder),
                    typeof(Comment)
                };
            }
        }

        public override IEnumerable<Type> CreatableTypes
        {
            get 
            {
                return new[] { typeof(Comment) };
            }
        }

        public override IEnumerable<ContentReference> Roots
        {
            get
            {
                return Enumerable.Empty<ContentReference>();
            }
        }

        public override IEnumerable<Type> MainNavigationTypes
        {
            get
            {
                return new[]
                {
                    typeof(ContentFolder)
                };
            }
        }
    }

ComponentDefinition

[Component]
public class CommentsPaneNavigationComponent : ComponentDefinitionBase
{
    public CommentsPaneNavigationComponent() : base("epi-cms.component.SharedBlocks")
    {
        Categories = new[] { "content" };
        Title = "Comments";
        SortOrder = 1000;
        PlugInAreas = new[] { PlugInArea.AssetsDefaultGroup };
        Settings.Add(new Setting("repositoryKey", CommentsPaneDescriptor.RepositoryKey));
    }
}

⬅️ BACK