Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Adding a shortcut pane in assets widget

Vote:
 

I'm working on a project that has a lot of content folders in a hierarchy that makes it a bit diffucult to navigate. My idea is to add a new navigation pane, as Episerver.Forms does, to the asset widget. For this purpose I've created a IContentRepositoryDescriptor:

[ServiceConfiguration(typeof (IContentRepositoryDescriptor))]
    public class CourtFolderRepositoryDescriptor : ContentRepositoryDescriptorBase
    {
        public CourtFolderRepositoryDescriptor()
        {
        }

        public static string RepositoryKey
        {
            get
            {
                return "YourCourts";
            }
        }

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

        public override string Name
        {
            get
            {
                return "Court Folders";
            }
        }

        public override IEnumerable Roots
        {
            get
            {
                var courtsAssetFolder = new ContentReference(6);
                var courtShortName = "da";
                var courtAssetFolder = ServiceLocator.Current.GetInstance().GetChildren(courtsAssetFolder)
                    .FirstOrDefault(folder => string.Equals(folder.Name, courtShortName, StringComparison.OrdinalIgnoreCase));

                return new[] { courtAssetFolder.ContentLink };
            }
        }

        public override IEnumerable ContainedTypes
        {
            get
            {
                return new[] { typeof(MediaData), typeof(ContentFolder) };
            }
        }

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

        public override IEnumerable CreatableTypes
        {
            get
            {
                return new[] { typeof(MediaData), typeof(ContentFolder) };
            }
        }

and a Component:

[Component]
    public sealed class CourtFolderComponent : ComponentDefinitionBase
    {
        public CourtFolderComponent()
            : base("epi-cms.widget.HierarchicalList")
        {
            Categories = new[] { "content" };
            LanguagePath = "/components/courtfolder";
            SortOrder = 1000;
            PlugInAreas = new[] { PlugInArea.AssetsDefaultGroup };
            Settings.Add(new Setting("repositoryKey", CourtFolderRepositoryDescriptor.RepositoryKey));
        }
    }

The contents of the asset folder returned as root won't load however. Can anybody spot the problem?

Regards,

Bjørn Terje Svennes

#149814
Jun 08, 2016 12:47
Vote:
 

Hi,

I'm having the exact same problem. Did you ever find a solution to this ?

#151067
Jul 11, 2016 1:15
Vote:
 
#151177
Jul 12, 2016 23:34
Vote:
 

Hi. I've been away on holiday so I haven't had the chance to reply. I guess you have found the answer. I fixed the problem by inheriting from MediaComponent instead of ComponentDefinitionBase (and remebering to set the repository key by updating "repositoryKey" and not adding it). But I see now that this wasn't the actual fix. By chance I also changed the repository key to lower case which fits the thread you are linking to.

#151477
Jul 25, 2016 8:01
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.