Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Custom Content Provider in EpiServer add-on, The content is not displayed in the asset pane

Vote:
 

I am working on a content provider that is packaged as an add-on. The provider succeeds in creating all content and I can see it in Admin -> Set Acces Rights, and I can see the tab in the asset panel. But in the area where the folder structure will appear, I often get up folders from the other tabs "For all sites" etc. Sometimes, however, the provider works as intended and my contents appear as it should. Is there anyone else who has encountered this?

I've followed this guide to create the add-on

http://mariajemaria.net/initial-code-simple-episerver-addon

And this for the content provider

https://world.episerver.com/blogs/Per-Magne-Skuseth/Dates/2014/11/content-providers-101--part-i-introduction-initialization-ui--identity-mapping/

The Component

   [Component]
    class AssetComponent : ComponentDefinitionBase
    {
        private static readonly ILogger Logger = LogManager.GetLogger();
       
        public AssetComponent() : base("epi-cms/widget/HierarchicalList")
        {
            Logger.Debug("Initialized");
            var settingsHelper = new SettingsHelper();
            var settings = settingsHelper.GetSettings();

            string tabName = settings.TabName;
            
            Categories = new string[] { "content" };
            Title = tabName;
            Description = "Displays external assets";
            SortOrder = 1000;
            PlugInAreas = new[] { PlugInArea.AssetsDefaultGroup };
            Settings.Add(new Setting("repositoryKey", AssetProvider.Key));
       
        }
    }


The RepositoryDescriptor

    [ServiceConfiguration(typeof(IContentRepositoryDescriptor))]
    class AssetRepositoryDescriptor : ContentRepositoryDescriptorBase
    {
        protected Injected ContentProviderManager { get; set; }
        public override string Key => AssetProvider.Key;
        public override string Name => "DAL";

        public override IEnumerable Roots => new[] { ContentProviderManager.Service.GetProvider(AssetProvider.Key).EntryPoint };
        public override IEnumerable ContainedTypes => new[] { typeof(Asset), typeof(AssetImage), typeof(AssetDocument), typeof(AssetMultimedia) };
        public override IEnumerable MainNavigationTypes => new[] { typeof(ContentFolder) };

        public override string SearchArea => AssetProvider.Key;
        public bool ChangeContextOnItemSelection => true;
    }

This is the first time I make an addon and I'm not so familiar with Dojo and javascrip in EpiServer so all help is appreciated.
/Johan

#186493
Dec 20, 2017 17:55
Vote:
 

Might be completely unrelated but I had a similar issue when I replaced the catalog search provider, sometimes it would use my provider and sometimes the old one.

I finally figured it out and got around it by implementing ISortable and setting a low SortOrder. The standard providers didn't implement the interface at all and got a default SortOrder.

It's a long shot but it sounded so familiar so thought I should mention it. embarassed

#186509
Dec 21, 2017 10:45
Vote:
 

Which version of Episerver are you running?

Try using "epi-cms/asset/HierarchicalList" instead. "epi-cms/widget/HierarchicalList" has been deprecated for some time, and removed in EPiServer.CMS.UI 11.1.0.

#186546
Dec 22, 2017 10:03
Vote:
 

Thanks for the advice, I tried to change the order of components, but as i did it i got an error in another part of the addon:

Server Error in '/' Application. There is no build provider registered for the extension '.cshtml'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

So i found this:

https://stackoverflow.com/questions/15330712/runtime-error-there-is-no-build-provider-registered-for-the-extension-cshtml/22375286

And setting optimizeCompilations to false in web.config (in the project that the addon is installed in) made the problem go away. 
 
#186713
Edited, Jan 02, 2018 16:17
Vote:
 
#187266
Jan 17, 2018 10:47
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.